forked from Walderr/ZE-Plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LastHumanGlow.sp
68 lines (56 loc) · 1.46 KB
/
LastHumanGlow.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
58
59
60
61
62
63
64
65
66
67
68
#include <sdktools>
#include <cstrike>
bool glow;
bool glowEnabled[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "Last Human Glow",
author = "Walderr",
description = "Выделяет последнего выжившего",
version = "0.2",
};
public OnPluginStart()
{
HookEvent("player_team", Event_PlayerTeam);
HookEvent("round_start", Event_RoundStart);
CreateTimer(1.0, Timer_CheckGlow, _, TIMER_REPEAT);
}
public Action Event_PlayerTeam(Handle event, const char[] name, bool dontBroadcast)
{
if(GetEventInt(event, "oldteam") == CS_TEAM_CT) CreateTimer(0.0, Timer_CheckHumans);
}
public Action Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
{
for(int i = 1; i <= MaxClients; i++) glowEnabled[i] = false;
glow = false;
}
public Action Timer_CheckHumans(Handle timer)
{
if(GetTeamClientCount(CS_TEAM_CT) > 1) return;
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT)
{
glow = true;
glowEnabled[i] = true;
break;
}
}
}
public Action Timer_CheckGlow(Handle timer)
{
if(!glow) return;
for(int i = 1; i <= MaxClients; i++)
{
if(glowEnabled[i])
{
if(!IsClientConnected(i) || !IsClientInGame(i) || GetClientTeam(i) != CS_TEAM_CT)
{
glowEnabled[i] = false;
break;
}
SetEntPropFloat(i, Prop_Send, "m_flDetectedByEnemySensorTime", GetGameTime() + 2.0);
break;
}
}
}