It looks like you're trying to store the data for every player in one array, so I fixed your code for you:
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Players' Rate CVars"
#define VERSION "1.0"
#define AUTHOR "Vet(3TT3V)"
#define MAX_PLAYERS 32
new g_info[MAX_PLAYERS+1][256]
new g_pos[MAX_PLAYERS+1]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_rate_info", "cmd_get_rates", ADMIN_CFG, "Get players' rate CVars")
}
public cmd_get_rates(id)
{
static iPlayers[32], name[32]
new pid, iNum
get_players(iPlayers, iNum, "ch")
for(new i = 0; i < iNum; i++)
{
pid = iPlayers[i]
get_user_name(pid, name, 31)
g_pos[pid] = format(g_info[pid], 255, "%s ", name)
query_client_cvar(pid, "rate", "query_results")
query_client_cvar(pid, "cl_updaterate", "query_results")
query_client_cvar(pid, "cl_cmdrate", "query_results")
console_print(pid, "Exit info %s", name)
}
return PLUGIN_HANDLED
}
public query_results(id, cvar_name[], cvar_value[])
{
g_pos[id] += format(g_info[id][g_pos[id]], 255-g_pos[id], "%s=%s ", cvar_name, cvar_value)
console_print(id, g_info) // Test info printout
}
Now, about the
console_print(id, "Exit info %s", g_info[pid]) executing before
query_results().
When you query for a client cvar, you are telling the server to call
query_results when it receives information about the cvar you tell it to query. This process is not instant, so the "Exit info" prints first and later on, when information about the client's cvar is received,
query_results is executed and prints the "%s=%s".