View Single Post
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 08-05-2011 , 09:07   Re: SDK Hooks 2.0 - It's beta time again!
#1518

Can somebody help me?
What wrong with this code?

Code:
...
SDKHook(client, SDKHook_OnTakeDamage, TakeDamage);
...

public Action:TakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
	if ( IsClient(attacker) 
	&& IsClient(victim)
	&& GetClientFrags(attacker) >= GetMaxFrags() 
	&& GetClientTeam(attacker) != GetClientTeam(victim) )
	{
		PrintToChat(attacker,MSG,"kill");
		ForcePlayerSuicide(attacker);
		
		damage = 0.0;
		
		return Plugin_Changed;
	}
	
	return Plugin_Continue;
}
It spam errors like this:
Code:
L 08/05/2011 - 16:22:48: [SM] Native "GetClientFrags" reported: Client index 46 is invalid
L 08/05/2011 - 16:22:48: [SM] Displaying call stack trace for plugin "bonuses.smx":
L 08/05/2011 - 16:22:48: [SM]   [0]  Line 490, bonuses.sp::TakeDamage()
L 08/05/2011 - 16:22:48: [SM] Native "GetClientFrags" reported: Client index 46 is invalid
L 08/05/2011 - 16:22:48: [SM] Displaying call stack trace for plugin "bonuses.smx":
L 08/05/2011 - 16:22:48: [SM]   [0]  Line 490, bonuses.sp::TakeDamage()
L 08/05/2011 - 16:22:48: [SM] Native "GetClientFrags" reported: Client index 46 is invalid
L 08/05/2011 - 16:22:48: [SM] Displaying call stack trace for plugin "bonuses.smx":
L 08/05/2011 - 16:22:48: [SM]   [0]  Line 490, bonuses.sp::TakeDamage()

Last edited by Yeah=}; 08-05-2011 at 09:12.
Yeah=} is offline