Having some error which I think is even crashing the server.
Can someone tell me whats wrong with this? It says the error. Im not seeing whats wrong with it. Its pointing to this line. GetClientWeapon(attacker, sWeapon, sizeof(sWeapon));
This is a player_hurt hook if that matters.
"zf_sounds.smx":
L 03/22/2009 - 10:41:01: [SM] [0] Line 219, zf_sounds.sp::Event_ZFplayerhurt()
L 03/22/2009 - 10:42
5: [SM] Native "GetClientWeapon" reported: Client index 0 is invalid
L 03/22/2009 - 10:42
5: [SM] Displaying call stack trace for plugin
Code:
public Action:Event_ZFplayerhurt(Handle:event, const String:name[],bool:dontBroadcast)
{
if (g_enabled)
{
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
//Get attackers weapon
decl String:sWeapon[32];
GetClientWeapon(attacker, sWeapon, sizeof(sWeapon));
//Check weapon
//PrintToChatAll("\x01Current Weapon is: \x04%s", sWeapon);
if (StrEqual("tf_weapon_bat",sWeapon))
{
new Float:vecPos[3];
GetClientAbsOrigin(attacker, vecPos);
EmitSoundToAll(g_aSound, attacker, SNDCHAN_AUTO, SNDLEVEL_NORMAL, _, 1.0, _, _, vecPos, _, true, 0.0);
}
if (StrEqual("tf_weapon_bat_wood",sWeapon))
{
new Float:vecPos[3];
GetClientAbsOrigin(attacker, vecPos);
EmitSoundToAll(g_aSound, attacker, SNDCHAN_AUTO, SNDLEVEL_NORMAL, _, 1.0, _, _, vecPos, _, true, 0.0);
}
if (StrEqual("tf_weapon_knife",sWeapon))
{
new Float:vecPos[3];
GetClientAbsOrigin(attacker, vecPos);
EmitSoundToAll(g_aSound, attacker, SNDCHAN_AUTO, SNDLEVEL_NORMAL, _, 1.0, _, _, vecPos, _, true, 0.0);
}
if (StrEqual("tf_weapon_fists",sWeapon))
{
new Float:vecPos[3];
GetClientAbsOrigin(attacker, vecPos);
EmitSoundToAll(g_bSound, attacker, SNDCHAN_AUTO, SNDLEVEL_NORMAL, _, 1.0, _, _, vecPos, _, true, 0.0);
}
}
return Plugin_Continue;
}