Raised This Month: $ Target: $400
 0% 

Iterating over players to get info


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-23-2009 , 09:24   Re: Iterating over players to get info
Reply With Quote #4

1. the values from query_client.. does not show on first run

This is because the way query_client_cvar works. It does the
request and then the response is handled by a separate function.
In this case, the response has not yet been received from the client
at the time that you print to the user. What you can do is make
the user notification occur at the final requested cvar value in your
handler function. ie, suppose you request cl_rate, cl_updaterate and ex_interp.
When ex_interp is received in cvarCheck function, print all your cvar values.

2. Have yet to get cl_rate to work

IIRC, this one may not be retrievable. Don't quote me on it but I
do recall there being some client values that are not retrievable.

Am also wondering how I am supposed to know how big buffers I need for things such as the lineOut var (the line printed to console), or the responses from query_client_cvar - where/how would I find out?

You need to know the maximum possible string that will be stored in
the buffer and use that + 1. This is why everyone uses 31 or 32 for
strings to hold user names.

Can Pawn handle a switch here? case "cl_rate" etc?

No, you cannot switch a string value

formatex(g_iClRates[index], strlen(cvar_value), "%s", cvar_value);
^ also working, but is it copy or format which is the preferable one in this case?
If not using format, should one do str_to_num() to assure one has the correct type of data?


Any time you are working with an integer value it is always better to
use an integer type. As you know, pawn does not have any data types
so you will just be using a standard array. [not 2-dimension as you would
for string]

g_iClRates[index] = str_to_num( cvar_value );

and you have to redimension the array

new g_iClRates[MAX_PLAYERS]
__________________

Last edited by Bugsy; 06-23-2009 at 09:27.
Bugsy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode