PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
public OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float 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(inflictor, weaponName, sizeof(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 < 1 || client > MaxClients)
{
return false;
}
return IsClientInGame(client);
}
__________________