I have this code, but it doesn't work... I have no idea why. Is something wrong with me?
PHP Code:
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_OnTakeDamage, Hook_OnTakeDamage);
}
public Action Hook_OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype)
{
if(ValidPlayer(victim) && ValidPlayer(attacker))
{
if(GetClientTeam(attacker) == GetClientTeam(victim))
{
int heal = 20;
int oldhp = GetClientHealth(victim);
if(oldhp + heal > 100)
{
SetEntityHealth(victim,100);
}
else
{
SetEntityHealth(victim, heal + oldhp);
}
PrintToChat(attacker, "You healed your teammate!");
PrintToChat(victim, "Your teammate healed you!");
}
}
return Plugin_Continue;
}