[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(client, clientname, 256);
}
decl String:attackername[256];
if (IsClientConnected(attacker) ) {
GetClientName(attacker, attackername, 256);
}
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", weapon, 64);
if ( !g_isKnifeRound && !g_isNoscopeRound) { //if its a normal round
if ( StrEqual(weapon, weapon_awp) || StrEqual(weapon, weapon_scout) ) { //if its a awp or scout hit
g_noknifeabuseReg[client][attacker] = true;
if ( clienthp > 0 ) { //if the player still alive, which means a leg
CPrintToChat(attacker, "%s You leg'd {RED}%s{NORMAL} now you can knife him!", SOURCEMODSTRING, clientname);
CPrintToChat(client, "%s {RED}%s{NORMAL} Have leg'd you, now he can knife you!", SOURCEMODSTRING, attackername);
}
} 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 ( IsClientConnected( attacker ) ) { //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);
}
}
}
}
}