AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   SM_Hosties (https://forums.alliedmods.net/forumdisplay.php?f=155)
-   -   [CS:S/CS:GO] SM_Hosties (v2.2.0, 2015-08-15) (https://forums.alliedmods.net/showthread.php?t=108810)

databomb 01-12-2011 12:35

Re: [CSS] SM_Hosties (v1.11)
 
I ended up making new global vars for the deagle entities and then doing this:

PHP Code:

public Action:Event_WeaponFire(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
LRinprogress)
    {
        if ((
s4s_doubleshot_action != 0) && (LRtype == 1))
        {
            new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
            
// check if an LR player made the shot
            
if ((LRprogressplayer1 == client) || (LRprogressplayer2 == client))
            {
                
decl String:FiredWeapon[32];
                
GetEventString(event"weapon"FiredWeaponsizeof(FiredWeapon));
                
                
// if firing weapon isn't a deagle
                
if ((StrContains(FiredWeapon,"deagle",false) == -1))
                {
                    
// take varying action against the perp based on convars
                    
S4SRebelAction(client);
                }
                
// firing weapon IS a deagle
                
else
                {
                    
// get the entity index of the active weapon
                    
new iClientWeapon GetEntDataEnt2(clientFindSendPropInfo("CCSPlayer""m_hActiveWeapon"));                
                    
// check for double shot situation (if they picked up another deagle with more ammo between shots)
                    // person who fired last is the same as person who fired now
                    
if (S4Slastshot == client)
                    {
                        
// check if entity index is for either deagle spawned for S4S
                        
if ((iClientWeapon != S4Sdeagle1) && (iClientWeapon != S4Sdeagle2))
                        {
                            
S4SRebelAction(client);
                        }
                    }
                    else 
// if we didn't repeat
                    
{
                            
                        if (
GetConVarInt(sm_hosties_lr_s4s_shot_taken) == 1)
                        {
                            
PrintToChatAll(MESS"S4S Shot Taken"client);
                        }
                        
                        
// give the opposite LR player 1 bullet in their deagle
                        
if (client == LRprogressplayer1)
                        {
                            
// modify deagle 2s ammo
                            
SetEntData(S4Sdeagle2FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 1);
                        }
                        else if (
client == LRprogressplayer2)
                        {
                            
// modify deagle 1s ammo
                            
SetEntData(S4Sdeagle1FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 1);
                        }                
                    

                    }
                    
S4Slastshot client;
                }                
            }
        } 
//end if LR s4s and punishment convar set
    
// end if LR in progress
    
return Plugin_Continue;
// end Event_WeaponFire 

So what happens when you hold down the +attack? It will say you've taken a shot when you really haven't taken it and give the other person a bullet. Also one problem I was having with the ammo checks is that when the weapon_fire event goes off it seems like the ammo information isn't there yet (like it still reports 1 bullet left). I'm probably not doing the ammo checks correctly...

databomb 01-12-2011 12:58

Re: [CSS] SM_Hosties (v1.11)
 
Confirmed.. the ammo checks are not working, here's what I did:

PHP Code:

                    else // if we didn't repeat
                    
{
                        
// check if we're still at 1 ammo
                        
new currentammo GetEntData(iClientWeaponFindSendPropInfo("CBaseCombatWeapon""m_iClip1"));
                        
LogMessage("current ammo is %i",currentammo); 

I always show 1 ammo regardless of holding down or not holding down +attack. Any ideas on how else to check the ammo?

databomb 01-12-2011 13:24

Re: [CSS] SM_Hosties (v1.11)
 
So I didn't figure out why the ammo was reporting strangely but if we proactively set the ammo after they fire then it fixes it! When you hold down +attack running this code it will switch from weapon_fire events to throwing weapon_fire_on_empty events :)

PHP Code:

                        // give the opposite LR player 1 bullet in their deagle
                        
if (client == LRprogressplayer1)
                        {
                            
// modify deagle 2s ammo
                            
SetEntData(S4Sdeagle2FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 1);
                            
SetEntData(S4Sdeagle1FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 0);
                        }
                        else if (
client == LRprogressplayer2)
                        {
                            
// modify deagle 1s ammo
                            
SetEntData(S4Sdeagle1FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 1);
                            
SetEntData(S4Sdeagle2FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 0);
                        } 


databomb 01-12-2011 18:52

Re: [CSS] SM_Hosties (v1.11)
 
Ok, changing the ammo turns out to be a bad idea, it play tests fine with 2 people but with 10 or so I get an entity error:

Entity 457 (class 'weapon_deagle') reported ENTITY_CHANGE_NONE but 'm_iClip1' changed.

May be running into some kind of race condition here. I just commented out the lines to change the ammo to 0. Honestly, I'm fine with it now for my own purposes, if you hold down the attack then you just get penalized by losing your shot. Let me know if you solve the mystery

psychonic 01-12-2011 21:08

Re: [CSS] SM_Hosties (v1.11)
 
Quote:

Originally Posted by databomb (Post 1392351)
Entity 457 (class 'weapon_deagle') reported ENTITY_CHANGE_NONE but 'm_iClip1' changed.

http://docs.sourcemod.net/api/index....ad=show&id=67&

databomb 01-13-2011 00:55

Re: [CSS] SM_Hosties (v1.11)
 
Thank you psychonic!

I added this function into the mix and got some interesting results. That cleared the error messages about ENTITY_CHANGE_NONE up straight away.. but when it came time to test the S4S while holding down +attack, I saw some weird bug where both players think and look like they're shooting on the client screen (the gun fires, leaves an impact, etc.) but no actual damage is given out despite a point-blank shot to the head.

PHP Code:

public Action:Event_WeaponFire(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
LRinprogress)
    {
        
// shot 4 shot
        
if (LRtype == 1)
        {
            new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
            
// check if an LR player made the shot
            
if ((LRprogressplayer1 == client) || (LRprogressplayer2 == client))
            {
                
decl String:FiredWeapon[32];
                
GetEventString(event"weapon"FiredWeaponsizeof(FiredWeapon));
                
                
// if firing weapon isn't a deagle
                
if ((StrContains(FiredWeapon,"deagle",false) == -1) && (s4s_doubleshot_action != 0))
                {
                    
// take varying action against the perp based on convars
                    
S4SRebelAction(client);
                }
                
// firing weapon IS a deagle
                
else
                {
                    
// get the entity index of the active weapon
                    
new iClientWeapon GetEntDataEnt2(clientFindSendPropInfo("CCSPlayer""m_hActiveWeapon"));                
                    
// check for double shot situation (if they picked up another deagle with more ammo between shots)
                    // person who fired last is the same as person who fired now
                    
if (S4Slastshot == client)
                    {
                        
// check if entity index is for either deagle spawned for S4S
                        
if ((iClientWeapon != S4Sdeagle1) && (iClientWeapon != S4Sdeagle2) && (s4s_doubleshot_action != 0))
                        {
                            
S4SRebelAction(client);
                        }
                    }
                    else 
// if we didn't repeat
                    
{
                        
// check if we're still at 1 ammo
                        // new currentammo = GetEntData(iClientWeapon, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"));
                        // LogMessage("current ammo is %i",currentammo);
                            
                        
if (GetConVarInt(sm_hosties_lr_s4s_shot_taken) == 1)
                        {
                            
PrintToChatAll(MESS"S4S Shot Taken"client);
                        }
                        
                        
// give the opposite LR player 1 bullet in their deagle
                        
if (client == LRprogressplayer1)
                        {
                            
// modify deagle 2s ammo
                            
SetEntData(S4Sdeagle2FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 1);
                            
SetEntData(S4Sdeagle1FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 0);
                        }
                        else if (
client == LRprogressplayer2)
                        {
                            
// modify deagle 1s ammo
                            
SetEntData(S4Sdeagle1FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 1);
                            
SetEntData(S4Sdeagle2FindSendPropInfo("CBaseCombatWeapon""m_iClip1"), 0);
                        }                
                    
                        
// update the ammo immediately! (thanks psychonic)
                        
ChangeEdictState(S4Sdeagle1FindSendPropInfo("CBaseCombatWeapon""m_iClip1"));
                        
ChangeEdictState(S4Sdeagle2FindSendPropInfo("CBaseCombatWeapon""m_iClip1"));

                    }
                    
S4Slastshot client;
                }                
            }
        } 
//end if LR s4s and punishment convar set
    
// end if LR in progress
    
return Plugin_Continue;
// end Event_WeaponFire 


namine 01-13-2011 16:06

Re: [CSS] SM_Hosties (v1.11)
 
Dodgeball LR is broken. When you throw the flash at the opposing guy, nothing happens.

dataviruset 01-13-2011 16:07

Re: [CSS] SM_Hosties (v1.11)
 
Quote:

Originally Posted by namine (Post 1392921)
Dodgeball LR is broken. When you throw the flash at the opposing guy, nothing happens.

Huh? Noblock activated, or what? Are you running another noblock plugin, perhaps?

Phireman 01-14-2011 05:17

Re: [CSS] SM_Hosties (v1.11)
 
What is the command to allow terorirst to get knives on round start?
Its really important,please answer asap!

dataviruset 01-14-2011 10:51

Re: [CSS] SM_Hosties (v1.11)
 
Quote:

Originally Posted by Phireman (Post 1393251)
What is the command to allow terorirst to get knives on round start?
Its really important,please answer asap!

There are no setting for giving knives to Ts on round start, they should get knives automatically.


All times are GMT -4. The time now is 12:23.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.