10
10
#endif
11
11
12
12
# define PLUGIN " Deathrun: Informer"
13
- # define VERSION " 0.4 "
13
+ # define VERSION " 0.5 "
14
14
# define AUTHOR " Mistrick"
15
15
16
16
#pragma semicolon 1
17
17
18
18
# define UPDATE_INTERVAL 1 .0
19
+ // #define DONT_SHOW_FOR_ALIVE
19
20
20
21
new const PREFIX[] = " [DRI]" ;
21
22
22
23
new g_szCurMode[32 ], g_iConnectedCount, g_iMaxPlayers, g_iHudInformer, g_iHudSpecList, g_iHudSpeed;
23
- new bool: g_bAlive[33 ], bool: g_bInformer[33 ], bool: g_bSpeed[33 ], bool: g_bSpecList[33 ];
24
+ new bool: g_bConnected[ 33 ], bool: g_bAlive[33 ], bool: g_bInformer[33 ], bool: g_bSpeed[33 ], bool: g_bSpecList[33 ];
24
25
new g_iHealth[33 ], g_iMoney[33 ], g_iFrames[33 ], g_iPlayerFps[33 ];
25
26
26
27
public plugin_init ()
@@ -51,13 +52,15 @@ public plugin_init()
51
52
}
52
53
public client_putinserver (id)
53
54
{
55
+ g_bConnected[id] = true ;
54
56
g_bInformer[id] = true ;
55
57
g_bSpecList[id] = true ;
56
58
g_bSpeed[id] = true ;
57
59
g_iConnectedCount++ ;
58
60
}
59
61
public client_disconnect (id)
60
62
{
63
+ g_bConnected[id] = false ;
61
64
g_bAlive[id] = false ;
62
65
g_iConnectedCount-- ;
63
66
}
@@ -128,36 +131,32 @@ public Task_ShowInfo()
128
131
iLen += formatex (szInformer[iLen], charsmax (szInformer) - iLen, " All Players: %d /%d " , g_iConnectedCount, g_iMaxPlayers);
129
132
130
133
static szSpecInfo[1152 ];
131
- new iAllPlayers[32 ], iAllNum; get_players (iAllPlayers, iAllNum, " ch" );
132
- for (new id, i; i < iAllNum; i++ )
134
+ for (new id = 1 ; id <= g_iMaxPlayers; id++ )
133
135
{
134
- id = iAllPlayers[i] ;
136
+ if ( ! g_bConnected[id]) continue ;
135
137
136
- if (g_iHealth[id] >= 255 )
137
- {
138
- set_dhudmessage (55 , 245 , 55 , 0 .02 , 0 .90 , 0 , _, UPDATE_INTERVAL - 0 .05 , _, _, false );
139
- show_dhudmessage (id, " Health: %d " , g_iHealth[id]);
140
- }
141
138
if (g_bInformer[id])
142
139
{
143
140
set_hudmessage (55 , 245 , 55 , 0 .02 , 0 .18 , 0 , _, UPDATE_INTERVAL, _, _, 3 );
144
141
ShowSyncHudMsg (id, g_iHudInformer, szInformer);
145
142
}
146
-
147
143
148
144
if (! g_bAlive[id]) continue ;
149
145
150
- new iDeadPlayers[32 ], iDeadNum; get_players (iDeadPlayers, iDeadNum, " bch" );
151
-
152
- if (iDeadNum == 0 ) continue ;
146
+ if (g_iHealth[id] >= 255 )
147
+ {
148
+ set_dhudmessage (55 , 245 , 55 , 0 .02 , 0 .90 , 0 , _, UPDATE_INTERVAL - 0 .05 , _, _, false );
149
+ show_dhudmessage (id, " Health: %d " , g_iHealth[id]);
150
+ }
153
151
154
152
new bool: bShowInfo[33 ];
155
153
get_user_name (id, szName, charsmax (szName));
156
154
iLen = formatex (szSpecInfo, charsmax (szSpecInfo), " Player: %s ^nHealth: %d HP, Money: $%d , FPS: %d ^n" , szName, g_iHealth[id], g_iMoney[id], g_iPlayerFps[id]);
157
155
158
- for (new dead, j; j < iDeadNum; j ++ )
156
+ for (new dead = 1 ; dead <= g_iMaxPlayers; dead ++ )
159
157
{
160
- dead = iDeadPlayers[j];
158
+ if (! g_bConnected[dead] || g_bAlive[dead]) continue ;
159
+
161
160
if (pev (dead, pev_iuser2) == id)
162
161
{
163
162
get_user_name (dead, szName, charsmax (szName));
@@ -169,9 +168,11 @@ public Task_ShowInfo()
169
168
}
170
169
if (bShowInfo[id])
171
170
{
172
- for (new player, j; j < iAllNum; j++ )
171
+ #if defined DONT_SHOW_FOR_ALIVE
172
+ bShowInfo[id] = false ;
173
+ #endif
174
+ for (new player = 1 ; player < g_iMaxPlayers; player++ )
173
175
{
174
- player = iAllPlayers[j];
175
176
if (g_bSpecList[player] && bShowInfo[player])
176
177
{
177
178
set_hudmessage (245 , 245 , 245 , 0 .70 , 0 .15 , 0 , _, UPDATE_INTERVAL, _, _, 3 );
@@ -185,10 +186,8 @@ public Task_ShowInfo()
185
186
public Task_ShowSpeed ()
186
187
{
187
188
new Float: fSpeed, Float: fVelocity[3 ], iSpecmode;
188
- new players[32 ], pnum; get_players (players, pnum, " ch" );
189
- for (new id, i, target; id < pnum; i++ )
189
+ for (new id = 1 , target; id <= g_iMaxPlayers; id++ )
190
190
{
191
- id = players[i];
192
191
if (! g_bSpeed[id]) continue ;
193
192
194
193
iSpecmode = pev (id, pev_iuser1);
@@ -208,7 +207,13 @@ public dr_selected_mode(id, mode)
208
207
}
209
208
stock get_ct (& alive, & count)
210
209
{
211
- new players[32 ];
212
- get_players (players, count, " ceh" , " CT" );
213
- get_players (players, alive, " aceh" , " CT" );
210
+ count = 0 ; alive = 0 ;
211
+ for (new id = 1 ; id <= g_iMaxPlayers; id++ )
212
+ {
213
+ if (g_bConnected[id])
214
+ {
215
+ count++ ;
216
+ if (g_bAlive[id]) alive++ ;
217
+ }
218
+ }
214
219
}
0 commit comments