This one has me bugged. In this test code...
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Players' Rate CVars"
#define VERSION "1.0"
#define AUTHOR "Vet(3TT3V)"
new g_info[256]
new g_pos
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], info[32]
new pid, iNum, i
get_players(iPlayers, iNum, "ch")
for (i = 0; i < iNum; i++) {
pid = iPlayers[i]
get_user_name(pid, info, 31)
g_pos = format(g_info, 255, "%s ",info)
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(id, "Exit info %s", g_info)
}
return PLUGIN_HANDLED
}
public query_results(id, cvar_name[], cvar_value[])
{
g_pos += format(g_info[g_pos], 255, "%s=%s ", cvar_name, cvar_value)
console_print(id, g_info) // Test info printout
}
The console prints...
Code:
Exit info 3TT3V
3TT3V rate=10000
3TT3V rate=10000 cl_updaterate=45
3TT3V rate=10000 cl_updaterate=45 cl_cmdrate=45
I put the console_print in the query_results() routine to see what was going on. It shows the info is getting into the g_info array, but the console_print at the end of the cmd_get_rates() prints first and without the query_results() info.
I bet its something ridiculously simple. But I'll be damned if I can find it.
Any ideas???
__________________