Quote:
Originally Posted by shuttle_wave
where is the best place to but cs_get_user_team(id) so i wouldnt need to do it again. So afta i can just use g_iTeam
|
That is an array for all players currently on the server, you need to assign each element of the array for each individual player; each cs_get_user_team() call is only for a single player.
If you need to constantly have all player teams populated into the array then you can hook TeamInfo.
untested
PHP Code:
#include <amxmodx>
#include <cstrike>
new g_iOldTeam[ 33 ];
new CsTeams:g_iTeam[ 33 ];
public plugin_init()
{
register_event( "TeamInfo" , "fw_EvTeamInfo" , "a" );
}
public fw_EvTeamInfo()
{
new szTeam[ 2 ] , iPlayer = read_data( 1 );
read_data( 2 , szTeam , charsmax( szTeam ) );
if( szTeam[ 0 ] != g_iOldTeam[ iPlayer ] )
{
switch ( szTeam[ 0 ] )
{
case 'U': g_iTeam[ iPlayer ] = CS_TEAM_UNASSIGNED;
case 'T': g_iTeam[ iPlayer ] = CS_TEAM_T;
case 'C': g_iTeam[ iPlayer ] = CS_TEAM_CT;
case 'S': g_iTeam[ iPlayer ] = CS_TEAM_SPECTATOR;
}
g_iOldTeam[ iPlayer ] = szTeam[ 0 ];
}
}
__________________