-
Notifications
You must be signed in to change notification settings - Fork 3
/
comp_noff.sp
57 lines (43 loc) · 1.48 KB
/
comp_noff.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#define PLUGIN_AUTHOR "f0re4ch"
#define PLUGIN_VERSION "1.0"
public Plugin:myinfo =
{
name = "Competitive Anti-FF",
author = PLUGIN_AUTHOR,
description = "Protects Players from Friendly-Fire but enable molotov damage",
version = PLUGIN_VERSION,
url = "http://kpservidores.com"
};
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])
{
char WeaponCallBack[32];
GetEdictClassname(inflictor, WeaponCallBack, sizeof(WeaponCallBack));
if (damagetype & DMG_FALL)
return Plugin_Continue;
if(!IsClientValid(attacker) && damagetype & DMG_BLAST) // C4 DAMAGE
return Plugin_Continue;
if(!IsClientValid(attacker) || !IsClientValid(victim))
return Plugin_Handled;
int attackerUserId = attacker;
int victimUserId = victim;
if ((!IsValidEntity(victimUserId)) || (!IsValidEntity(attackerUserId)))
return Plugin_Continue;
if ((strlen(WeaponCallBack) <= 0) || (attackerUserId == victimUserId) || (GetClientTeam(victimUserId) != GetClientTeam(attackerUserId)) )
return Plugin_Continue;
if (StrEqual(WeaponCallBack, "inferno", false))
return Plugin_Continue;
return Plugin_Handled;
}
public bool:IsClientValid(client)
{
if(client > 0 && client <= MaxClients && IsClientInGame(client))
return true;
return false;
}