Thread: dmg molotov
View Single Post
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 02-12-2019 , 11:53   Re: dmg molotov
Reply With Quote #2

PHP Code:

#include <sourcemod> 
#include <sdktools> 
#include <sdkhooks> 

public OnClientPutInServer(int client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 


public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3]) 
{
    if (
attacker == victim)
    {
        return 
Plugin_Continue// do self damage
    
}
    
    if (
inflictor != -1// if there are no inflictors, this should be -1, you can remove it if the damage in molotov doesnt work
    
{
        
char weaponName[32]; 
        
GetEdictClassname(inflictorweaponNamesizeof(weaponName)); 
        
        if (
StrEqual(weaponName"inferno"false))
        {
            return 
Plugin_Continue// do damage in molotov
        
}
    }
    
    if (
IsValidClient(victim))
    {
        if (
IsValidClient(attacker))
        {
            if (
GetClientTeam(attacker) == GetClientTeam(victim))
            {
                return 
Plugin_Handled// stop friendly fire, except molotovs
            
}
        }
    }
    
    return 
Plugin_Continue
}

bool IsValidClient(int client)
{
    if (
client || client MaxClients)
    {
        return 
false;
    }
    
    return 
IsClientInGame(client);

__________________
Ilusion9 is offline