-
Notifications
You must be signed in to change notification settings - Fork 0
/
speclist.sma
141 lines (113 loc) · 2.71 KB
/
speclist.sma
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include <amxmodx>
#include <fakemeta>
#pragma semicolon 1
#define RED 64
#define GREEN 64
#define BLUE 64
#define UPDATEINTERVAL 1.0
// Comment below if you do not want /speclist showing up on chat
#define ECHOCMD
// Admin flag used for immunity
#define FLAG ADMIN_BAN
new const PLUGIN[] = "SpecList";
new const VERSION[] = "1.2a";
new const AUTHOR[] = "FatalisDK";
new gMaxPlayers;
new gCvarOn;
new gCvarImmunity;
new bool:gOnOff[33] = { true, ... };
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_cvar(PLUGIN, VERSION, FCVAR_SERVER, 0.0);
gCvarOn = register_cvar("amx_speclist", "1", 0, 0.0);
gCvarImmunity = register_cvar("amx_speclist_immunity", "1", 0, 0.0);
register_clcmd("say /speclist", "cmdSpecList", -1, "");
gMaxPlayers = get_maxplayers();
set_task(UPDATEINTERVAL, "tskShowSpec", 123094, "", 0, "b", 0);
}
public cmdSpecList(id)
{
if( gOnOff[id] )
{
client_print(id, print_chat, "[Only Dead] Você não verá mais quem está se encontrando com você.");
gOnOff[id] = false;
}
else
{
client_print(id, print_chat, "[Only Dead] Agora você vai ver quem está te observando.");
gOnOff[id] = true;
}
#if defined ECHOCMD
return PLUGIN_CONTINUE;
#else
return PLUGIN_HANDLED;
#endif
}
public tskShowSpec()
{
if( !get_pcvar_num(gCvarOn) )
{
return PLUGIN_CONTINUE;
}
static szHud[1102];//32*33+45
static szName[34];
static bool:send;
// FRUITLOOOOOOOOOOOOPS!
for( new alive = 1; alive <= gMaxPlayers; alive++ )
{
new bool:sendTo[33];
send = false;
if( !is_user_alive(alive) )
{
continue;
}
sendTo[alive] = true;
get_user_name(alive, szName, 32);
format(szHud, 45, "Spectadores %s:^n", szName);
for( new dead = 1; dead <= gMaxPlayers; dead++ )
{
if( is_user_connected(dead) )
{
if( is_user_alive(dead)
|| is_user_bot(dead) )
{
continue;
}
if( pev(dead, pev_iuser2) == alive )
{
if( !(get_pcvar_num(gCvarImmunity)&&get_user_flags(dead, 0)&FLAG) )
{
get_user_name(dead, szName, 32);
add(szName, 33, "^n", 0);
add(szHud, 1101, szName, 0);
send = true;
}
sendTo[dead] = true;
}
}
}
if( send == true )
{
for( new i = 1; i <= gMaxPlayers; i++ )
{
if( sendTo[i] == true
&& gOnOff[i] == true )
{
set_hudmessage(RED, GREEN, BLUE,
0.75, 0.15, 0, 0.0, UPDATEINTERVAL + 0.1, 0.0, 0.0, -1);
show_hudmessage(i, szHud);
}
}
}
}
return PLUGIN_CONTINUE;
}
public client_connect(id)
{
gOnOff[id] = true;
}
public client_disconnect(id)
{
gOnOff[id] = true;
}