If You need
only enemies can't harm the player
PHP Code:
#include <sourcemod>
#include <sdkhooks>
public void OnPluginStart()
{
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i)) SDKHook(i, SDKHook_OnTakeDamage, Event_OnTakeDamage);
}
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_OnTakeDamage, Event_OnTakeDamage);
}
public void OnClientDisconnect(int client)
{
SDKUnhook(client, SDKHook_OnTakeDamage, Event_OnTakeDamage);
}
public Action Event_OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype)
{
if(victim != attacker && 0 < victim <= MaxClients && 0 < attacker <= MaxClients && IsClientInGame(victim) && IsClientInGame(attacker) && GetClientTeam(victim) == GetClientTeam(attacker))
{
damage = 0.0;
return Plugin_Handled;
}
return Plugin_Continue;
}
__________________