This one requires DukeHacks, but I think it should work right. I confirmed that the previous code would turn off the slowdown if the scout was damaged during the slowdown period.
PHP Code:
#include <sourcemod>
#include <dukehacks>
new bool:Remove_Stun[MAXPLAYERS +1] = false;
public OnPluginStart()
{
HookEvent("player_hurt", Event_PlayerHurt);
dhAddClientHook(CHK_TakeDamage, TakeDamageHook);
}
public Action:Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
new target = GetClientOfUserId(GetEventInt(event, "userid"));
new playerstate = GetEntProp(target, Prop_Send, "m_nPlayerCond");
if ((playerstate & 32768) != 0 && Remove_Stun[target]){
Remove_Stun[target] = false;
SetEntProp(target, Prop_Send, "m_nPlayerCond", (playerstate & (~32768)));
}
}
public Action:TakeDamageHook(client, attacker, inflictor, Float:damage, &Float:multiplier)
{
new String:weapon[32];
GetEntityNetClass(inflictor, weapon, sizeof(weapon));
if(StrEqual(weapon, "CTFBat_Wood"))
Remove_Stun[client] = true;
return Plugin_Continue;
}