I have some question with this,and some doubts...
I want to use this in a menu,but I must made an delay to this,because if I made the menu on the forward called by sq_query(),the menu doesn't show the data of the server.
-How I must do to don't make a delay,and get the data of the server in that forward?
Maybe a task getting the data every 60 seconds,and when the user calls the menu,the menu shows the last data obteinad?
But I don't want to flood the server.
~~~~~~~~~~~~~~~~
How I can use the array called iServer
(See in the code) with more servers,or making a multiple array and use it,without hardcodding the plugin.
This is because I want to make a *.ini file and set my servers there and I have 10.
~~~~~~~~~~~~~~~~
I get this message when I compile the plugin.
Code:
Warning: Symbol is assigned a value that is never used: "iServer" on line 24
Why? I use iServer when I open the data of a server in sq_query().
~~~~~~~~~~~~~~~~
Here is my code.
Code:
#include <amxmodx>
#include <server_query>
/* Pragma */
#pragma semicolon 1
public plugin_init()
{
/* Plugin Registration */
register_plugin("Server Data","0.0.1","Fedde");
/* Command */
register_clcmd("say test","cmdTest");
}
public cmdTest(id)
{
new iServer;
new iError;
iServer = sq_query("201.212.2.185",27024,SQ_Server,"QueryResults",iError);
return PLUGIN_HANDLED;
}
public QueryResults(id,iServer,szBuffer[],iLen)
{
new Mapname[64];
new aPlayers,mPlayers;
new bool:Password;
sq_readbuffer_server(szBuffer,iLen,_,_,Mapname,charsmax(Mapname),_,_,_,_,_,aPlayers,mPlayers,_,_,_,Password);
server_print("Server Results : %s (%d/%d) %s",Mapname,aPlayers,mPlayers,Password ? "[Closed]" : "");
}
Thanks
Sorry for my bad english.
[NOTE]
I am testing how to make the plugin,thats why the plugin doesn't check somethings,like iError,etc.