| edgaras85 |
05-23-2010 15:07 |
Re: ID error
PHP Code:
#include <amxmodx> #include <cstrike> #include <engine> #define DELAY 0.5 #define HUD_STAY DELAY + 0.1 enum _:CVARS { RED, GREEN, BLUE, LOCATION }; enum _:TEAMS { TE, CT }; new g_pCvars[ CVARS ]; new const Float:g_flCoords[ ][ 2 ] = { { 0.02, -1.0 }, { 0.10, 0.40 }, { 0.28, 0.00 }, { 0.57, 0.00 }, { 0.57, 0.45 }, { 0.57, 0.78 }, { 0.27, 0.78 }, { 0.01, 0.78 }, { 0.31, 0.36 } } public plugin_init( ) { register_plugin( "Players Remaining", "1.0", "xPaw" ); g_pCvars[ RED ] = register_cvar( "amx_pr_red", "255" ); g_pCvars[ GREEN ] = register_cvar( "amx_pr_green", "0" ); g_pCvars[ BLUE ] = register_cvar( "amx_pr_blue", "0" ); g_pCvars[ LOCATION ] = register_cvar( "amx_pr_location", "5" ); new iEntity = create_entity( "info_target" ); if( is_valid_ent( iEntity ) ) { entity_set_string( iEntity, EV_SZ_classname, "PlayersRemainThinker" ); entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + DELAY ); register_think( "PlayersRemainThinker", "FwdThink" ); } else set_task( DELAY, "ShowMessage", _, _, _, "b" ); } public FwdThink( iEntity ) { ShowMessage( iEntity ); entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + DELAY ); } public ShowMessage( id ) { new iPlayers[ 32 ], iNum[ TEAMS ]; //get_players( iPlayers, iNum[ TE ], "ae", "TERRORIST" ); get_players( iPlayers, iNum[ CT ], "ae", "CT" ); if( iNum[ TE ] > 0 || iNum[ CT ] > 0 ) { new iCvars[ CVARS ]; iCvars[ RED ] = get_pcvar_num( g_pCvars[ RED ] ); iCvars[ GREEN ] = get_pcvar_num( g_pCvars[ GREEN ] ); iCvars[ BLUE ] = get_pcvar_num( g_pCvars[ BLUE ] ); iCvars[ LOCATION ] = get_pcvar_num( g_pCvars[ LOCATION ] ); if( iCvars[ LOCATION ] > sizeof( g_flCoords ) - 1 ) { set_pcvar_num( g_pCvars[ LOCATION ], 1 ); iCvars[ LOCATION ] = 1; } set_hudmessage( iCvars[ RED ], iCvars[ GREEN ], iCvars[ BLUE ], g_flCoords[ iCvars[ LOCATION ] ][ 0 ], g_flCoords[ iCvars[ LOCATION ] ][ 1 ], 0, HUD_STAY, HUD_STAY, 0.0, 0.0, 3 ); //show_hudmessage( 0, "Players Remaining^nTE: %i^nCT: %i", iNum[ TE ], iNum[ CT ] ); if(is_user_connected(id)) { new CsTeams:iTeam = cs_get_user_team(id); if (iTeam == CS_TEAM_T) { show_hudmessage(0, "Counter-Terrorists Remaining: %i", iNum[ CT ] ); } } } }
|