/* SpecInfo v1.2 Copyright (C) 2007 Ian (Juan) Cammarata This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; go to http://www.opensource.org/licenses/gpl-license.php -------------------------------------------------------------------------------- http://ian.cammarata.us Jul 14 21:15 Description: This plugin displays a list of spectators currently viewing the live player. This list is visible to the living player as well as other players currently spectating that player. Also spectators can see which movement commands the the live player is using. Commands: say /speclist : Toggle viewing list of spectators. say /speckeys : Toggle viewing keys of player you are spectating. say /spechide : Immune admins toggle whether or not they're hidden from list. Cvars (First value is default): si_enabled <1|0> : Enables all plugin functionality. si_list_enabled <1|0> : Enables spectator list. si_keys_enabled <1|0> : Enables spectator key view. si_list_default <1|0> : Default on/off state for spec list when a client joins. si_keys_default <1|0> : Default on/off state for key view when a client joins. si_immunity <0|1> : Enables admin immunity; Admins won't show on spec list. si_msg_r <45|...> : HUD message red value. si_msg_g <89|...> : HUD message green value. si_msg_b <116|...> : HUD message blue value. Notes: Make sure you place the specinfo.txt file in addons\amxmodx\data\lang Supported Languages: English (100%) Spanish (100%) - Thanks to <3 Mely <3 for checking these. German (78%) - Thanks to [S]killer for this translation. Change Log: Key (+ added | - removed | c changed | f fixed) v1.2 (Jul 14, 2007) +: Command "say /spechide" for immune to toggle hidden state. c: Lots of code optimizations. f: Always showing keys even when disabled. f: Hud messaged getting messed up when too many names are on the list. (No seriously, for real this time.) v1.1 (Jul 06, 2007) +: Show number of people spectating. c: Names truncated shorter than 20 chars when lots of players on the list. c: Spectator list moved further right. (Even further when you're alive.) f: Hud messaged getting messed up when too many names are on the list. (Same as last time, but it's fixed for good.) v1.0.1 (June 07, 2007) f: Hud messaged getting messed up when too many names are on the list. v1.0 (June 02, 2007) !Initial Release */ #include #include #include #include #define VERSION "1.2" #define IMMUNE_FLAG ADMIN_IMMUNITY #define KEYS_STR_LEN 31 #define LIST_STR_LEN 610 #define BOTH_STR_LEN KEYS_STR_LEN+LIST_STR_LEN //cvar pointers new p_enabled, p_list_enabled, p_keys_enabled, p_list_default, p_keys_default new p_red, p_grn, p_blu, p_immunity //data arrays new cl_keys[32], cl_prefs[32] new keys_string[32][KEYS_STR_LEN+1], list_string[32][LIST_STR_LEN+1] new cl_names[32][21], spec_ids[32][32] //cl_prefs constants #define FL_LIST (1<<0) #define FL_KEYS (1<<1) #define FL_HIDE (1<<2) public client_connect( id ) { cl_prefs[id-1] = 0 if( !is_user_bot( id ) ) { if( get_pcvar_num( p_list_default ) ) cl_prefs[id-1] |= FL_LIST if( get_pcvar_num( p_keys_default ) ) cl_prefs[id-1] |= FL_KEYS } get_user_name( id, cl_names[id-1], 20 ) return PLUGIN_CONTINUE } public client_infochanged( id ) { get_user_name( id, cl_names[id-1], 20 ) return PLUGIN_CONTINUE } public list_update( ) { if( get_pcvar_num( p_enabled ) && get_pcvar_num ( p_list_enabled ) ) { new players[32], num, id, id2, i, j for( i=1; i<33; i++ ) spec_ids[i-1][0] = 0 get_players( players, num, "bch" ) for( i=0; i