View Single Post
Author Message
EngHell
Member
Join Date: Jul 2013
Location: Guatemala
Old 11-12-2015 , 00:33   [HELP][CSGO]Server crashing when player tags another player with knife second click
Reply With Quote #1

[CSGO]
It only crashes when its a second click hit, not the first click, also theres no logs at sourcemod/logs and csgo/logs
Theres the code:
PHP Code:
public Action:EventPlayerHurt(Handle:event, const String:name[],bool:dontBroadcast) {
    new 
attacker GetClientOfUserId(GetEventInt(event"attacker"));
    if (
g_pluginenabled && g_noknifeabuseEnabled && !(attacker == 0) ) {
        new 
clienthp GetEventInt(event"health");
        new 
client GetClientOfUserId(GetEventInt(event"userid"));
        
decl String:clientname[256];
        if (
IsClientConnected(client) ){
            
GetClientName(clientclientname256);
        }
        
decl String:attackername[256];
        if (
IsClientConnected(attacker) ) {
            
GetClientName(attackerattackername256);
        }
        new 
String:weapon_knife[64] = "knife";
        new 
String:weapon_awp[64] = "awp";
        new 
String:weapon_scout[64] = "ssg08";
        
decl String:weapon[64];
        
GetEventString(event"weapon"weapon64);
        if ( !
g_isKnifeRound && !g_isNoscopeRound) { //if its a normal round
            
if ( StrEqual(weaponweapon_awp) || StrEqual(weaponweapon_scout) ) { //if its a awp or scout hit
                
g_noknifeabuseReg[client][attacker] = true;
                if ( 
clienthp ) { //if the player still alive, which means a leg
                    
CPrintToChat(attacker"%s You leg'd {RED}%s{NORMAL} now you can knife him!"SOURCEMODSTRINGclientname);
                    
CPrintToChat(client"%s {RED}%s{NORMAL} Have leg'd you, now he can knife you!"SOURCEMODSTRINGattackername);
                }
            } else if ( 
StrEqual(weapon,weapon_knife) ) { //if the hit is from a knife
                
if ( !g_noknifeabuseReg[client][attacker] ) { //if there was no a previous leg
                    
if (IsPlayerAlive(attacker) ) { //if the player stay alive
                        
if (IsClientConnected(attacker) ) { //if the player has not droped
                            
ForcePlayerSuicide(attacker);
                            
CPrintToChatAll("%s {RED}%s{NORMAL} Got slayed for not follow our knife !rules",SOURCEMODSTRING,attackername);
                        }
                    }
                }
            }        
        } else if ( 
g_isNoscopeRound ) { //else if  ITS A NOSCOPE ROUND
            
if (StrEqual(weapon,weapon_knife) ) {
                if (
IsPlayerAlive(attacker) ) { //still the player alive?
                    
if ( IsClientConnectedattacker ) ) { //still the player at server?
                        
ForcePlayerSuicide(attacker);
                        
CPrintToChatAll("%s {RED}%s{NORMAL} got slayed for not follow our knife !rules",SOURCEMODSTRING,attacker);
                    }
                }
            }
        } 
//since we dond need to do anything in the knife round...
        /*    
        if ( StrEqual(weapon, weapon_awp) || StrEqual(weapon, weapon_scout) ) {
            if( IsPlayerAlive(client) ) {
                g_noknifeabuseReg[client][attacker] = true;
                if ( IsClientConnected(client) ) {
                    CPrintToChat(attacker, "%s You legged %s you can knife him/her now",SOURCEMODSTRING,clientname);
                }
            }
        } else if ( StrEqual(weapon, weapon_knife) ) {
            if ( !g_noknifeabuseReg[client][attacker] ) {
                ForcePlayerSuicide(attacker);
            }
        }
        * */
    
}

The part where it crashes
PHP Code:
else if ( StrEqual(weapon,weapon_knife) ) { //if the hit is from a knife
                
if ( !g_noknifeabuseReg[client][attacker] ) { //if there was no a previous leg
                    
if (IsPlayerAlive(attacker) ) { //if the player stay alive
                        
if (IsClientConnected(attacker) ) { //if the player has not droped
                            
ForcePlayerSuicide(attacker);
                            
CPrintToChatAll("%s {RED}%s{NORMAL} Got slayed for not follow our knife !rules",SOURCEMODSTRING,attackername);
                        }
                    }
                }
            }        
        } 

Last edited by EngHell; 11-12-2015 at 00:35.
EngHell is offline