1 |
/* |
/* |
2 |
SpecInfo v1.2 |
SpecInfo v1.3 |
3 |
Copyright (C) 2007 Ian (Juan) Cammarata |
Copyright (C) 2007 Ian (Juan) Cammarata |
4 |
|
|
5 |
This program is free software; you can redistribute it and/or modify it under |
This program is free software; you can redistribute it and/or modify it under |
53 |
Supported Languages: |
Supported Languages: |
54 |
English (100%) |
English (100%) |
55 |
Spanish (100%) - Thanks to <3 Mely <3 for checking these. |
Spanish (100%) - Thanks to <3 Mely <3 for checking these. |
56 |
German (78%) - Thanks to [S]killer for this translation. |
German (63%) - Thanks to [S]killer for this translation. |
57 |
|
|
58 |
|
|
59 |
Change Log: |
Change Log: |
60 |
Key (+ added | - removed | c changed | f fixed) |
Key (+ added | - removed | c changed | f fixed) |
61 |
|
|
62 |
|
v1.3 (Nov xx, 2007) |
63 |
|
+: Command "/showkeys" to view your own keys. |
64 |
|
c: Minor code optimizations. |
65 |
|
|
66 |
v1.2 (Jul 14, 2007) |
v1.2 (Jul 14, 2007) |
67 |
+: Command "say /spechide" for immune to toggle hidden state. |
+: Command "say /spechide" for immune to toggle hidden state. |
68 |
c: Lots of code optimizations. |
c: Lots of code optimizations. |
86 |
#include <engine> |
#include <engine> |
87 |
#include <fakemeta> |
#include <fakemeta> |
88 |
|
|
89 |
#define VERSION "1.2" |
#define VERSION "1.3b1" |
90 |
#define IMMUNE_FLAG ADMIN_IMMUNITY |
#define IMMUNE_FLAG ADMIN_IMMUNITY |
91 |
|
|
92 |
#define KEYS_STR_LEN 31 |
#define KEYS_STR_LEN 31 |
98 |
new p_red, p_grn, p_blu, p_immunity |
new p_red, p_grn, p_blu, p_immunity |
99 |
|
|
100 |
//data arrays |
//data arrays |
101 |
new cl_keys[32], cl_prefs[32] |
new cl_keys[33], cl_prefs[33] |
102 |
new keys_string[32][KEYS_STR_LEN+1], list_string[32][LIST_STR_LEN+1] |
new keys_string[33][KEYS_STR_LEN+1], list_string[33][LIST_STR_LEN+1] |
103 |
new cl_names[32][21], spec_ids[32][32] |
new cl_names[33][21], spec_ids[33][32] |
104 |
|
|
105 |
//cl_prefs constants |
//cl_prefs constants |
106 |
#define FL_LIST (1<<0) |
#define FL_LIST (1<<0) |
107 |
#define FL_KEYS (1<<1) |
#define FL_KEYS (1<<1) |
108 |
#define FL_HIDE (1<<2) |
#define FL_OWNKEYS (1<<2) |
109 |
|
#define FL_HIDE (1<<3) |
110 |
|
|
111 |
|
public plugin_init( ) |
112 |
|
{ |
113 |
|
register_plugin( "SpecInfo", VERSION, "Ian Cammarata" ) |
114 |
|
register_cvar( "specinfo_version", VERSION, FCVAR_SERVER ) |
115 |
|
set_cvar_string( "specinfo_version", VERSION ) |
116 |
|
|
117 |
|
p_enabled = register_cvar( "si_enabled", "1" ) |
118 |
|
p_list_enabled = register_cvar( "si_list_enabled", "1" ) |
119 |
|
p_keys_enabled = register_cvar( "si_keys_enabled", "1" ) |
120 |
|
p_list_default = register_cvar( "si_list_default", "1" ) |
121 |
|
p_keys_default = register_cvar( "si_keys_default", "1" ) |
122 |
|
p_immunity = register_cvar( "si_immunity", "1" ) |
123 |
|
p_red = register_cvar( "si_msg_r", "45" ) |
124 |
|
p_grn = register_cvar( "si_msg_g", "89" ) |
125 |
|
p_blu = register_cvar( "si_msg_b", "116" ) |
126 |
|
|
127 |
|
register_clcmd( "say /speclist", "toggle_list", _, "Toggle spectator list." ) |
128 |
|
register_clcmd( "say /speckeys", "toggle_keys", _, "Toggle spectator keys." ) |
129 |
|
register_clcmd( "say /showkeys", "toggle_ownkeys", _, "Toggle viewing own keys." ) |
130 |
|
register_clcmd( "say /spechide", "toggle_hide", IMMUNE_FLAG, "Admins toggle being hidden from list." ) |
131 |
|
|
132 |
|
set_task( 1.0, "list_update", _, _, _, "b" ) |
133 |
|
set_task( 0.1, "keys_update", _, _, _, "b" ) |
134 |
|
|
135 |
|
register_dictionary( "specinfo.txt" ) |
136 |
|
} |
137 |
|
|
138 |
public client_connect( id ) |
public client_connect( id ) |
139 |
{ |
{ |
140 |
cl_prefs[id-1] = 0 |
cl_prefs[id] = 0 |
141 |
if( !is_user_bot( id ) ) |
if( !is_user_bot( id ) ) |
142 |
{ |
{ |
143 |
if( get_pcvar_num( p_list_default ) ) cl_prefs[id-1] |= FL_LIST |
if( get_pcvar_num( p_list_default ) ) cl_prefs[id] |= FL_LIST |
144 |
if( get_pcvar_num( p_keys_default ) ) cl_prefs[id-1] |= FL_KEYS |
if( get_pcvar_num( p_keys_default ) ) cl_prefs[id] |= FL_KEYS |
145 |
} |
} |
146 |
get_user_name( id, cl_names[id-1], 20 ) |
get_user_name( id, cl_names[id], 20 ) |
147 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
148 |
} |
} |
149 |
|
|
150 |
public client_infochanged( id ) |
public client_infochanged( id ) |
151 |
{ |
{ |
152 |
get_user_name( id, cl_names[id-1], 20 ) |
get_user_name( id, cl_names[id], 20 ) |
153 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
154 |
} |
} |
155 |
|
|
158 |
if( get_pcvar_num( p_enabled ) && get_pcvar_num ( p_list_enabled ) ) |
if( get_pcvar_num( p_enabled ) && get_pcvar_num ( p_list_enabled ) ) |
159 |
{ |
{ |
160 |
new players[32], num, id, id2, i, j |
new players[32], num, id, id2, i, j |
161 |
for( i=1; i<33; i++ ) spec_ids[i-1][0] = 0 |
for( i=1; i<33; i++ ) spec_ids[i][0] = 0 |
162 |
get_players( players, num, "bch" ) |
get_players( players, num, "bch" ) |
163 |
for( i=0; i<num; i++ ) |
for( i=0; i<num; i++ ) |
164 |
{ |
{ |
165 |
id = players[i] |
id = players[i] |
166 |
if( !( get_user_flags( id ) & IMMUNE_FLAG && get_pcvar_num( p_immunity ) && cl_prefs[id-1] & FL_HIDE ) ) |
if( !( get_user_flags( id ) & IMMUNE_FLAG && get_pcvar_num( p_immunity ) && cl_prefs[id] & FL_HIDE ) ) |
167 |
{ |
{ |
168 |
id2 = pev( id, pev_iuser2 ) |
id2 = pev( id, pev_iuser2 ) |
169 |
if( id2 ) |
if( id2 ) |
177 |
new count, namelen, tmpname[21] |
new count, namelen, tmpname[21] |
178 |
for( i=1; i<33; i++ ) |
for( i=1; i<33; i++ ) |
179 |
{ |
{ |
180 |
count = spec_ids[i-1][0] |
count = spec_ids[i][0] |
181 |
if( count ) |
if( count ) |
182 |
{ |
{ |
183 |
namelen = ( LIST_STR_LEN - 10 ) / count |
namelen = ( LIST_STR_LEN - 10 ) / count |
184 |
clamp( namelen, 10, 20 ) |
clamp( namelen, 10, 20 ) |
185 |
format( tmpname, namelen, cl_names[i-1] ) |
format( tmpname, namelen, cl_names[i] ) |
186 |
formatex( tmplist, LIST_STR_LEN - 1, "^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t(%d) %s %s:^n", count, "%L", tmpname) |
formatex( tmplist, LIST_STR_LEN - 1, "^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t(%d) %s %s:^n", count, "%L", tmpname) |
187 |
for( j=1; j<=count; j++ ) |
for( j=1; j<=count; j++ ) |
188 |
{ |
{ |
189 |
format( tmpname, namelen, cl_names[spec_ids[i-1][j]-1]) |
format( tmpname, namelen, cl_names[spec_ids[i][j]]) |
190 |
formatex( tmpstr, 40, "^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t%s", tmpname ) |
formatex( tmpstr, 40, "^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t%s", tmpname ) |
191 |
if( strlen( tmplist ) + strlen( tmpstr ) + ( 11 - j ) < ( LIST_STR_LEN - 1 ) ) |
if( strlen( tmplist ) + strlen( tmpstr ) + ( 11 - j ) < ( LIST_STR_LEN - 1 ) ) |
192 |
format( tmplist, LIST_STR_LEN-10, "%s%s^n", tmplist, tmpstr ) |
format( tmplist, LIST_STR_LEN-10, "%s%s^n", tmplist, tmpstr ) |
197 |
} |
} |
198 |
} |
} |
199 |
if( count < 10 ) |
if( count < 10 ) |
200 |
format( tmplist, LIST_STR_LEN,\ |
format( tmplist, LIST_STR_LEN, |
201 |
"%s^n^n^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^tSpecInfo v%s^n",\ |
"%s^n^n^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^t^tSpecInfo v%s^n", |
202 |
tmplist, VERSION ) |
tmplist, VERSION |
203 |
|
) |
204 |
for( j+=0; j<10; j++ ) |
for( j+=0; j<10; j++ ) |
205 |
format( tmplist, LIST_STR_LEN, "%s%s", tmplist, "^n" ) |
format( tmplist, LIST_STR_LEN, "%s%s", tmplist, "^n" ) |
206 |
list_string[i-1] = tmplist |
list_string[i] = tmplist |
207 |
} |
} |
208 |
} |
} |
209 |
get_players( players, num, "ch" ) |
get_players( players, num, "ch" ) |
214 |
|
|
215 |
public keys_update( ) |
public keys_update( ) |
216 |
{ |
{ |
217 |
if( get_pcvar_num( p_enabled ) && get_pcvar_num( p_keys_enabled ) ) |
if( !get_pcvar_num( p_enabled ) && !get_pcvar_num( p_keys_enabled ) ) return |
218 |
{ |
|
219 |
new players[32], num, id, i |
new players[32], num, id, i |
220 |
get_players( players, num, "a" ) |
get_players( players, num, "a" ) |
221 |
for( i=0; i<num; i++ ) |
for( i=0; i<num; i++ ) |
222 |
{ |
{ |
223 |
id = players[i] |
id = players[i] |
224 |
formatex( keys_string[id-1], KEYS_STR_LEN, " ^n^t^t%s^t^t^t%s^n^t%s %s %s^t^t%s",\ |
formatex( keys_string[id], KEYS_STR_LEN, " ^n^t^t%s^t^t^t%s^n^t%s %s %s^t^t%s", |
225 |
cl_keys[id-1] & IN_FORWARD ? "W" : " .",\ |
cl_keys[id] & IN_FORWARD ? "W" : " .", |
226 |
"%L",\ |
"%L", |
227 |
cl_keys[id-1] & IN_MOVELEFT ? "A" : ".",\ |
cl_keys[id] & IN_MOVELEFT ? "A" : ".", |
228 |
cl_keys[id-1] & IN_BACK ? "S" : ".",\ |
cl_keys[id] & IN_BACK ? "S" : ".", |
229 |
cl_keys[id-1] & IN_MOVERIGHT ? "D" : ".",\ |
cl_keys[id] & IN_MOVERIGHT ? "D" : ".", |
230 |
"%L" ) |
"%L" |
231 |
|
) |
232 |
|
|
233 |
//Flags stored in string to fill translation char in clmsg function |
//Flags stored in string to fill translation char in clmsg function |
234 |
keys_string[id-1][0] = 0 |
keys_string[id][0] = 0 |
235 |
if( cl_keys[id-1] & IN_JUMP ) keys_string[id-1][0] |= IN_JUMP |
if( cl_keys[id] & IN_JUMP ) keys_string[id][0] |= IN_JUMP |
236 |
if( cl_keys[id-1] & IN_DUCK ) keys_string[id-1][0] |= IN_DUCK |
if( cl_keys[id] & IN_DUCK ) keys_string[id][0] |= IN_DUCK |
237 |
|
|
238 |
cl_keys[id-1] = 0 |
cl_keys[id] = 0 |
239 |
} |
} |
240 |
|
|
241 |
get_players( players, num, "bch" ) |
new id2 |
242 |
|
get_players( players, num, "ch" ) |
243 |
for( i=0; i<num; i++ ) |
for( i=0; i<num; i++ ) |
244 |
{ |
{ |
245 |
id = players[i] |
id = players[i] |
246 |
if( cl_prefs[id-1] & FL_KEYS && pev( id, pev_iuser2 ) ) clmsg( id ) |
if( is_user_alive( id ) ) |
247 |
|
{ |
248 |
|
if( cl_prefs[id] & FL_OWNKEYS ) clmsg( id ) |
249 |
} |
} |
250 |
|
else |
251 |
|
{ |
252 |
|
id2 = pev( id, pev_iuser2 ) |
253 |
|
if( cl_prefs[id] & FL_KEYS && id2 && id2 != id ) clmsg( id ) |
254 |
} |
} |
255 |
return PLUGIN_HANDLED |
} |
256 |
|
|
257 |
} |
} |
258 |
|
|
259 |
public server_frame( ) |
public server_frame( ) |
265 |
for( new i=0; i<num; i++ ) |
for( new i=0; i<num; i++ ) |
266 |
{ |
{ |
267 |
id = players[i] |
id = players[i] |
268 |
if( /*!( cl_keys[id-1] & IN_FORWARD ) &&*/ get_user_button( id ) & IN_FORWARD ) |
if( get_user_button( id ) & IN_FORWARD ) |
269 |
cl_keys[id-1]|=IN_FORWARD |
cl_keys[id] |= IN_FORWARD |
270 |
if( /*!( cl_keys[id-1] & IN_BACK ) &&*/ get_user_button( id ) & IN_BACK ) |
if( get_user_button( id ) & IN_BACK ) |
271 |
cl_keys[id-1]|=IN_BACK |
cl_keys[id] |= IN_BACK |
272 |
if( /*!( cl_keys[id-1] & IN_MOVELEFT ) &&*/ get_user_button( id ) & IN_MOVELEFT ) |
if( get_user_button( id ) & IN_MOVELEFT ) |
273 |
cl_keys[id-1]|=IN_MOVELEFT |
cl_keys[id] |= IN_MOVELEFT |
274 |
if( /*!( cl_keys[id-1] & IN_MOVERIGHT ) &&*/ get_user_button( id ) & IN_MOVERIGHT ) |
if( get_user_button( id ) & IN_MOVERIGHT ) |
275 |
cl_keys[id-1]|=IN_MOVERIGHT |
cl_keys[id] |= IN_MOVERIGHT |
276 |
if( /*!( cl_keys[id-1] & IN_DUCK ) &&*/ get_user_button( id ) & IN_DUCK ) |
if( get_user_button( id ) & IN_DUCK ) |
277 |
cl_keys[id-1]|=IN_DUCK |
cl_keys[id] |= IN_DUCK |
278 |
if( /*!( cl_keys[id-1] & IN_JUMP ) &&*/ get_user_button( id ) & IN_JUMP ) |
if( get_user_button( id ) & IN_JUMP ) |
279 |
cl_keys[id-1]|=IN_JUMP |
cl_keys[id] |= IN_JUMP |
280 |
} |
} |
281 |
} |
} |
282 |
return PLUGIN_CONTINUE |
return PLUGIN_CONTINUE |
284 |
|
|
285 |
public clmsg( id ) |
public clmsg( id ) |
286 |
{ |
{ |
287 |
if( id ) |
if( !id ) return |
288 |
{ |
|
289 |
if( is_user_alive( id ) ) |
new prefs = cl_prefs[id] |
290 |
{ |
|
291 |
if( cl_prefs[id-1] & FL_LIST && spec_ids[id-1][0] && get_pcvar_num( p_list_enabled ) ) |
new bool:show_own = false |
292 |
|
if( is_user_alive( id ) && prefs & FL_OWNKEYS ) show_own = true |
293 |
|
|
294 |
|
if( is_user_alive( id ) && !show_own ) |
295 |
{ |
{ |
296 |
set_hudmessage(\ |
if( prefs & FL_LIST && spec_ids[id][0] && get_pcvar_num( p_list_enabled ) ) |
297 |
get_pcvar_num( p_red ),\ |
{ |
298 |
get_pcvar_num( p_grn ),\ |
set_hudmessage( |
299 |
get_pcvar_num( p_blu ),\ |
get_pcvar_num( p_red ), |
300 |
0.7/*x*/,\ |
get_pcvar_num( p_grn ), |
301 |
0.1/*y*/,\ |
get_pcvar_num( p_blu ), |
302 |
0/*fx*/,\ |
0.7, /*x*/ |
303 |
0.0/*fx time*/,\ |
0.1, /*y*/ |
304 |
1.1/*hold time*/,\ |
0, /*fx*/ |
305 |
0.1/*fade in*/,\ |
0.0, /*fx time*/ |
306 |
0.1/*fade out*/,\ |
1.1, /*hold time*/ |
307 |
3/*chan*/ ) |
0.1, /*fade in*/ |
308 |
show_hudmessage( id, list_string[id-1], id, "SPECTATING" ) |
0.1, /*fade out*/ |
309 |
|
3 /*chan*/ |
310 |
|
) |
311 |
|
show_hudmessage( id, list_string[id], id, "SPECTATING" ) |
312 |
} |
} |
313 |
} |
} |
314 |
else |
else |
315 |
{ |
{ |
316 |
new id2 = pev( id, pev_iuser2 ) |
new id2 |
317 |
if( ( cl_prefs[id-1] & FL_LIST || cl_prefs[id-1] & FL_KEYS ) && id2 && id != id2 ) |
if( show_own ) id2 = id |
318 |
{ |
else id2 = pev( id, pev_iuser2 ) |
319 |
set_hudmessage(\ |
if( !id2 ) return |
320 |
get_pcvar_num( p_red ),\ |
|
321 |
get_pcvar_num( p_grn ),\ |
if( prefs & FL_LIST || prefs & FL_KEYS || show_own ) |
322 |
get_pcvar_num( p_blu ),\ |
{ |
323 |
0.48/*x*/,\ |
set_hudmessage( |
324 |
0.14/*y*/,\ |
get_pcvar_num( p_red ), |
325 |
0/*fx*/,\ |
get_pcvar_num( p_grn ), |
326 |
0.0/*fx time*/,\ |
get_pcvar_num( p_blu ), |
327 |
cl_prefs[id-1]&FL_KEYS ? 0.1 : 1.1/*hold time*/,\ |
0.48, /*x*/ |
328 |
0.1/*fade in*/,\ |
0.14, /*y*/ |
329 |
0.1/*fade out*/,\ |
0, /*fx*/ |
330 |
3/*chan*/ ) |
0.0, /*fx time*/ |
331 |
|
prefs & FL_KEYS || show_own ? 0.1 : 1.1, /*hold time*/ |
332 |
|
0.1, /*fade in*/ |
333 |
|
0.1, /*fade out*/ |
334 |
|
3 /*chan*/ |
335 |
|
) |
336 |
new msg[BOTH_STR_LEN+1] |
new msg[BOTH_STR_LEN+1] |
337 |
if( cl_prefs[id-1] & FL_LIST && get_pcvar_num( p_list_enabled ) && spec_ids[id2-1][0] ) |
if( prefs & FL_LIST && get_pcvar_num( p_list_enabled ) && spec_ids[id2][0] ) |
338 |
formatex(msg,BOTH_STR_LEN,list_string[id2-1],id,"SPECTATING") |
formatex(msg,BOTH_STR_LEN,list_string[id2],id,"SPECTATING") |
339 |
else msg ="^n^n^n^n^n^n^n^n^n^n^n^n" |
else msg ="^n^n^n^n^n^n^n^n^n^n^n^n" |
340 |
if( cl_prefs[id-1] & FL_KEYS && get_pcvar_num( p_keys_enabled ) ) |
if( get_pcvar_num( p_keys_enabled ) && ( prefs & FL_KEYS || show_own ) ) |
341 |
{ |
{ |
342 |
format( msg, BOTH_STR_LEN, "%s%s", msg, keys_string[id2-1][1] ) |
format( msg, BOTH_STR_LEN, "%s%s", msg, keys_string[id2][1] ) |
343 |
format( msg, BOTH_STR_LEN, msg,\ |
format( msg, BOTH_STR_LEN, msg, |
344 |
id,\ |
id, keys_string[id2][0] & IN_JUMP ? "JUMP" : "LAME", |
345 |
keys_string[id2-1][0] & IN_JUMP ? "JUMP" : "LAME",\ |
id, keys_string[id2][0] & IN_DUCK ? "DUCK" : "LAME" |
346 |
id,\ |
) |
|
keys_string[id2-1][0] & IN_DUCK ? "DUCK" : "LAME" ) |
|
347 |
} |
} |
348 |
show_hudmessage( id, msg ) |
show_hudmessage( id, msg ) |
349 |
} |
} |
350 |
} |
} |
351 |
} |
} |
|
return PLUGIN_HANDLED |
|
|
} |
|
352 |
|
|
353 |
public set_hudmsg_flg_notify( ) |
public set_hudmsg_flg_notify( ) |
354 |
{ |
{ |
355 |
set_hudmessage(\ |
set_hudmessage( |
356 |
get_pcvar_num( p_red ),\ |
get_pcvar_num( p_red ), |
357 |
get_pcvar_num( p_grn ),\ |
get_pcvar_num( p_grn ), |
358 |
get_pcvar_num( p_blu ),\ |
get_pcvar_num( p_blu ), |
359 |
-1.0 /*x*/ ,\ |
-1.0, /*x*/ |
360 |
0.8 /*y*/ ,\ |
0.8, /*y*/ |
361 |
0 /*fx*/ ,\ |
0, /*fx*/ |
362 |
0.0 /*fx time*/ ,\ |
0.0, /*fx time*/ |
363 |
3.0 /*hold time*/ ,\ |
3.0, /*hold time*/ |
364 |
0.0 /*fade in*/ ,\ |
0.0, /*fade in*/ |
365 |
0.0 /*fade out*/ ,\ |
0.0, /*fade out*/ |
366 |
-1 /*chan*/ ) |
-1 /*chan*/ |
367 |
|
) |
368 |
} |
} |
369 |
|
|
370 |
public toggle_list( id ) |
public toggle_list( id ) |
371 |
{ |
{ |
372 |
set_hudmsg_flg_notify( ) |
set_hudmsg_flg_notify( ) |
373 |
cl_prefs[id-1] ^= FL_LIST |
cl_prefs[id] ^= FL_LIST |
374 |
show_hudmessage( id, "%L", id, cl_prefs[id-1] & FL_LIST ? "SPEC_LIST_ENABLED" : "SPEC_LIST_DISABLED" ) |
show_hudmessage( id, "%L", id, cl_prefs[id] & FL_LIST ? "SPEC_LIST_ENABLED" : "SPEC_LIST_DISABLED" ) |
375 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
376 |
} |
} |
377 |
|
|
378 |
public toggle_keys( id ) |
public toggle_keys( id ) |
379 |
{ |
{ |
380 |
set_hudmsg_flg_notify( ) |
set_hudmsg_flg_notify( ) |
381 |
cl_prefs[id-1] ^= FL_KEYS |
cl_prefs[id] ^= FL_KEYS |
382 |
show_hudmessage( id, "%L", id, cl_prefs[id-1] & FL_KEYS ? "SPEC_KEYS_ENABLED" : "SPEC_KEYS_DISABLED" ) |
show_hudmessage( id, "%L", id, cl_prefs[id] & FL_KEYS ? "SPEC_KEYS_ENABLED" : "SPEC_KEYS_DISABLED" ) |
383 |
|
return PLUGIN_HANDLED |
384 |
|
} |
385 |
|
|
386 |
|
public toggle_ownkeys( id ) |
387 |
|
{ |
388 |
|
set_hudmsg_flg_notify( ) |
389 |
|
cl_prefs[id] ^= FL_OWNKEYS |
390 |
|
show_hudmessage( id, "%L", id, cl_prefs[id] & FL_OWNKEYS ? "SPEC_OWNKEYS_ENABLED" : "SPEC_OWNKEYS_DISABLED" ) |
391 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
392 |
} |
} |
393 |
|
|
396 |
if( cmd_access( id, level, cid, 0 ) ) |
if( cmd_access( id, level, cid, 0 ) ) |
397 |
{ |
{ |
398 |
set_hudmsg_flg_notify( ) |
set_hudmsg_flg_notify( ) |
399 |
cl_prefs[id-1] ^= FL_HIDE |
cl_prefs[id] ^= FL_HIDE |
400 |
show_hudmessage( id, "%L", id, cl_prefs[id-1] & FL_HIDE ? "SPEC_HIDE_ENABLED" : "SPEC_HIDE_DISABLED" ) |
show_hudmessage( id, "%L", id, cl_prefs[id] & FL_HIDE ? "SPEC_HIDE_ENABLED" : "SPEC_HIDE_DISABLED" ) |
401 |
} |
} |
402 |
return PLUGIN_HANDLED |
return PLUGIN_HANDLED |
403 |
} |
} |
|
|
|
|
public plugin_init( ) |
|
|
{ |
|
|
register_plugin( "SpecInfo", VERSION, "Ian Cammarata" ) |
|
|
register_cvar( "specinfo_version", VERSION, FCVAR_SERVER ) |
|
|
|
|
|
p_enabled = register_cvar( "si_enabled", "1" ) |
|
|
p_list_enabled = register_cvar( "si_list_enabled", "1" ) |
|
|
p_keys_enabled = register_cvar( "si_keys_enabled", "1" ) |
|
|
p_list_default = register_cvar( "si_list_default", "1" ) |
|
|
p_keys_default = register_cvar( "si_keys_default", "1" ) |
|
|
p_immunity = register_cvar( "si_immunity", "1" ) |
|
|
p_red = register_cvar( "si_msg_r", "45" ) |
|
|
p_grn = register_cvar( "si_msg_g", "89" ) |
|
|
p_blu = register_cvar( "si_msg_b", "116" ) |
|
|
|
|
|
register_clcmd( "say /speclist", "toggle_list", _, "Toggle spectator list." ) |
|
|
register_clcmd( "say /speckeys", "toggle_keys", _, "Toggle spectator keys." ) |
|
|
register_clcmd( "say /spechide", "toggle_hide", IMMUNE_FLAG, "Admins toggle being hidden from list." ) |
|
|
|
|
|
set_task( 1.0, "list_update", _, _, _, "b" ) |
|
|
set_task( 0.1, "keys_update", _, _, _, "b" ) |
|
|
|
|
|
register_dictionary( "specinfo.txt" ) |
|
|
} |
|