Trying to get all player names and printing to admin's console.
Code:
enum
{
TEAM_NONE,
TEAM_T,
TEAM_CT,
TEAM_SPEC,
MAX_TEAMS
};
#define OFFSET_TEAM 114
#define fm_get_user_team(%1) get_pdata_int(%1, OFFSET_TEAM)
new g_max_clients;
public plugin_init()
{
// ...
g_max_clients = get_maxplayers();
}
// ...
new name[32], team, all_names[MAX_TEAMS][sizeof(name) * 32]; // 32 player names
for( new i = 1; i <= g_max_clients; i++ )
{
if( !is_user_connected(i) )
{
continue;
}
team = fm_get_user_team(i);
if( team != TEAM_T && team != TEAM_CT )
{
continue;
}
get_user_name(i, name, sizeof(name) - 1);
if( all_names[team][0] )
{
format(all_names[team], sizeof(all_names[]) - 1, "%s, %s", all_names[team], name);
}
else
{
copy(all_names[team], sizeof(all_names[]) - 1, name);
}
}
console_print(client, "%s ; %s", all_names[TEAM_T], all_names[TEAM_CT]);
__________________