Raised This Month: $51 Target: $400
 12% 

[CS:S/CS:GO] SM_Hosties (v2.2.0, 2015-08-15)


Post New Thread Reply   
 
Thread Tools Display Modes
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 01-12-2011 , 12:35   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #601

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 is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 01-12-2011 , 12:58   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #602

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 is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 01-12-2011 , 13:24   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #603

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 is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 01-12-2011 , 18:52   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #604

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
databomb is offline
psychonic

BAFFLED
Join Date: May 2008
Old 01-12-2011 , 21:08   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #605

Quote:
Originally Posted by databomb View Post
Entity 457 (class 'weapon_deagle') reported ENTITY_CHANGE_NONE but 'm_iClip1' changed.
http://docs.sourcemod.net/api/index....ad=show&id=67&
psychonic is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 01-13-2011 , 00:55   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #606

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 

Last edited by databomb; 01-13-2011 at 00:59. Reason: added code
databomb is offline
namine
SourceMod Donor
Join Date: Jul 2010
Old 01-13-2011 , 16:06   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #607

Dodgeball LR is broken. When you throw the flash at the opposing guy, nothing happens.
namine is offline
dataviruset
AlliedModders Donor
Join Date: Feb 2009
Location: Hong Kong
Old 01-13-2011 , 16:07   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #608

Quote:
Originally Posted by namine View Post
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?
dataviruset is offline
Phireman
BANNED
Join Date: Jan 2011
Old 01-14-2011 , 05:17   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #609

What is the command to allow terorirst to get knives on round start?
Its really important,please answer asap!
Phireman is offline
dataviruset
AlliedModders Donor
Join Date: Feb 2009
Location: Hong Kong
Old 01-14-2011 , 10:51   Re: [CSS] SM_Hosties (v1.11)
Reply With Quote #610

Quote:
Originally Posted by Phireman View Post
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.
dataviruset is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:16.


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