Raised This Month: $51 Target: $400
 12% 

Server Query


Post New Thread Reply   
 
Thread Tools Display Modes
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-29-2012 , 09:36   Re: Server Query
Reply With Quote #21

Quote:
Originally Posted by K.K.Lv View Post
I'm lazy to remake a inc file. because I have done a dll.
as far as i know, when query the server rules, need to check whether or not there are more than packet recv. you know, the max packet size is 1400
You have to correctly read the buffer, and it's going to tell you packet number, how much packets are there, and other information as described here

Quote:
Originally Posted by K.K.Lv View Post
second I have said that first packet should start at [16], if there is a second packet recv, need to copy the buffer at [9]
This is a workaround, while it's going to work, it's not advised to do that.
__________________
xPaw is offline
chungsy
Member
Join Date: Nov 2011
Old 03-24-2013 , 02:33   Re: Server Query
Reply With Quote #22

Quote:
Originally Posted by Scherzo View Post
Server Queries

Library to asynchronous request fetching information about other server of HL game. Server queries - Valve Developer Community


Available requests:





Info. Server name, map name, current number of players, max number of players, name of game.
Code:
stock ServerInfo(const szServer[], const szCallback[]);
Code:
new const SERVER_ADDRESS[] = "192.168.0.14:27015";
 
public info()
{ 
ServerInfo(SERVER_ADDRESS, "cbInfo");
return PLUGIN_HANDLED;
}
 
public cbInfo(const szServer[], _A2A_TYPE, const Response[], len, success, latency)
{ 
if(!success)
return;
 
new szName[64], szMap[64], szDirectory[64], szDescription[64];
new iPlayers = 0;
new iMaxPlayers = 0;
 
ServerResponseParseInfo(Response, szName, 63, szMap, 63, szDirectory, 63, szDescription, 63, iPlayers, iMaxPlayers);
 
client_print(0, print_chat, "Server name: %s", szName);
client_print(0, print_chat, "Map: %s", szMap);
client_print(0, print_chat, "Folder: %s", szDirectory);
client_print(0, print_chat, "Description: %s", szDescription);
client_print(0, print_chat, "Players: %d / %d", iPlayers, iMaxPlayers);
}
CODE]



Hi, I'm getting errors when I put the code together

L 03/20/2013 - 209:12: [AMXX] Run time error 5: memory access
L 03/20/2013 - 209:12: [AMXX] [0] server_query.inc::ServerResponseReadByte (line 230)
L 03/20/2013 - 209:12: [AMXX] [1] server_query.inc::ServerResponseParseInfo (line 119)
L 03/20/2013 - 209:12: [AMXX] [2] serversinfo.sma::cbInfo (line 48 )

Does anyone know what's the reason for this?

My plugin compiles all the time, but doesn't work correctly
Attached Files
File Type: sma Get Plugin or Get Source (chungsy_serverinfo.sma - 468 views - 1,023 Bytes)

Last edited by chungsy; 03-24-2013 at 02:42.
chungsy is offline
Reply



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 11:31.


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