AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Some questions about server_query API by Exolent (https://forums.alliedmods.net/showthread.php?t=167994)

Fedde 09-22-2011 21:58

Some questions about server_query API by Exolent
 
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.

avril-lavigne 09-26-2011 16:09

Re: Some questions about server_query API by Exolent
 
I have another question
I cant use iPort in the example plugin
I can use iServer variable but cant iPort I dont know why.

Fedde 09-26-2011 20:50

Re: Some questions about server_query API by Exolent
 
Quote:

Originally Posted by avril-lavigne (Post 1563769)
I have another question
I cant use iPort in the example plugin
I can use iServer variable but cant iPort I dont know why.

You must use str_to_num() for iPort.

Fedde 10-07-2011 08:35

Re: Some questions about server_query API by Exolent
 
-bump-

Fedde 10-23-2011 00:50

Re: Some questions about server_query API by Exolent
 
-bump-


All times are GMT -4. The time now is 19:39.

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