forked from zonde306/l4d2sc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathl4d2_frozen_tank_fix.sp
54 lines (47 loc) · 1.09 KB
/
l4d2_frozen_tank_fix.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
#include <sourcemod>
#include <sdktools>
#define PL_VERSION "2.0"
public Plugin:myinfo =
{
name = "Fix frozen tanks",
version = PL_VERSION,
author = "sheo",
}
public OnPluginStart()
{
HookEvent("player_incapacitated", Event_PlayerIncap);
CreateConVar("l4d2_fix_frozen_tank_version", PL_VERSION, "Frozen tank fix version", FCVAR_PLUGIN | FCVAR_NOTIFY);
}
public Event_PlayerIncap(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client > 0 && IsPlayerTank(client))
{
CreateTimer(1.0, KillTank_tCallback);
}
}
public Action:KillTank_tCallback(Handle:timer)
{
for (new i = 1; i <= MaxClients; i++)
{
if (IsPlayerTank(i) && IsIncapitated(i))
{
ForcePlayerSuicide(i);
}
}
}
bool:IsIncapitated(client)
{
return bool:GetEntProp(client, Prop_Send, "m_isIncapacitated");
}
bool:IsPlayerTank(client)
{
if (IsClientInGame(client) && GetClientTeam(client) == 3)
{
if (GetEntProp(client, Prop_Send, "m_zombieClass") == 8)
{
return true;
}
}
return false;
}