Try this code
csgo
PHP Code:
#include <sdkhooks>
public void OnPluginStart()
{
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i)) OnClientPutInServer(i);
}
}
public void OnClientPutInServer(int client)
{
SDKHookEx(client, SDKHook_OnTakeDamageAlive, OnTakeDamageAlive);
}
public Action OnTakeDamageAlive(int victim, int& attacker, int& inflictor, float& damage, int& damagetype)
{
static ConVar mp_friendlyfire;
if(mp_friendlyfire == null)
{
mp_friendlyfire = FindConVar("mp_friendlyfire");
if(mp_friendlyfire == null) SetFailState("There is no ConVar 'mp_friendlyfire'");
}
if(damagetype == (DMG_SLASH|DMG_NEVERGIB) || damagetype == (DMG_SHOCK|DMG_NEVERGIB))
{
if( mp_friendlyfire.BoolValue && GetClientTeam(attacker) == GetClientTeam(victim) ) return Plugin_Handled;
}
return Plugin_Continue;
}
__________________