View Single Post
Author Message
impossible_cc
Senior Member
Join Date: Sep 2018
Location: Ukraine
Old 10-09-2018 , 09:28   Some manipulations with friendly fire..
Reply With Quote #1

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(clientSDKHook_OnTakeDamageHook_OnTakeDamage);
}
public 
Action Hook_OnTakeDamage(int victimintattackerintinflictorfloatdamageintdamagetype
{
    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(victimheal oldhp);
            }
            
            
PrintToChat(attacker"You healed your teammate!");
            
PrintToChat(victim"Your teammate healed you!");
        }
    }
    return 
Plugin_Continue;


Last edited by impossible_cc; 10-09-2018 at 13:41.
impossible_cc is offline