[Plugin] [REL] ServerQuery 1.1
#1

ServerQuery 1.1
With this plugin you can easily get server-information and rules from foreign servers.

Functions:
Code:
native GetInfoPacket(ip[],port);
native iIsPassworded();	
native iGetPlayers();
native iGetMaxPlayers();
native iGetHostname(hostname[]);
native iGetGamemode(gamemode[]);
native iGetMapname(mapname[]);

native GetRulesPacket(ip[],port);
native rGetRulesAmount();
native rGetRuleName(ruleid,rulename[]);
native rGetRuleValue(ruleid,rulevalue[]);

native GetPlayerPacket(ip[],port);
native cGetPlayers();
native cGetPlayerName(playerid,plname[]);
native cGetPlayerScore(playerid);
Usage:
First you need to retrieve a package. If you want to get the ServerInfo pagage you have to type:

Code:
GetInfoPacket("127.0.0.1",7777);
You can choose any IP you want.

If it returns 1, you got a package from the server. Then you can use each function with the letter 'i' at the beginning. If you use the function GetRulesPacket() you can use every function with the letter 'r' at the beginning.

For a full example you can download this filterscript.


To get the right ruleid you can use the order as the sa:mp client:
0...gravity
1...mapname
2...version
3...weather
4...weburl
6...worldtime


You don't need a plugin on another server. Only on your server.

Changelog
v.1.0:
- Release

v.1.1:
- Added rGetRulesAmount() (and rule amount max. is 20 now) to get modified rule keys
- Added Package 'c' functions:
you can now get the playerlist from a remote server.
- Added timout protection to prevent server crashes



Download:
ServerQuery v.1.0
ServerQuery v.1.1

ServerQuery v.1.1 - Mirror 2

Source
Reply
#2

looks nice ill check it out

EDIT*
err looks like it could be abused very easily
Reply
#3

I don't get it, why would you need to get the info for weburl etc.. Just take a peek in server.cfg?
Reply
#4

Quote:
Originally Posted by Faraday
I don't get it, why would you need to get the info for weburl etc.. Just take a peek in server.cfg?
It gets the information from REMOTE servers, not your own. (Well you could use it to get your own server information, but not much point like you said).

Looks great, I would use it.....but I run linux. I also noticed there was a makefile in there, whats the point of including a makefile when the plugin requires a windows header file? Just curious
Reply
#5

Quote:
Originally Posted by DavidC
Quote:
Originally Posted by Faraday
I don't get it, why would you need to get the info for weburl etc.. Just take a peek in server.cfg?
It gets the information from REMOTE servers, not your own. (Well you could use it to get your own server information, but not much point like you said).

Looks great, I would use it.....but I run linux. I also noticed there was a makefile in there, whats the point of including a makefile when the plugin requires a windows header file? Just curious
This could easily be abused - anyone could use this on any server.
Reply
#6

Quote:
Originally Posted by CJ101
Quote:
Originally Posted by DavidC
Quote:
Originally Posted by Faraday
I don't get it, why would you need to get the info for weburl etc.. Just take a peek in server.cfg?
It gets the information from REMOTE servers, not your own. (Well you could use it to get your own server information, but not much point like you said).

Looks great, I would use it.....but I run linux. I also noticed there was a makefile in there, whats the point of including a makefile when the plugin requires a windows header file? Just curious
This could easily be abused - anyone could use this on any server.
with what could this be abused?, you can get information from other servers, but that's not private information or something. Just go to your sa-mp client and add the server to your favourites, and here you go, the same information as this plugin can give.

OnTopic:

Nice Release, this could be handy when you are having multiple servers, you can check the player count and stuff. :P

Thank You
Reply
#7

D00Mpy is right, the information for accessing this data is available on the wiki:

https://sampwiki.blast.hk/wiki/Query_Mechanism (Thank westie for this )

Can use it in pretty much any language which supports UDP handling.

Reply
#8

Quote:
Originally Posted by DavidC
D00Mpy is right, the information for accessing this data is available on the wiki:

https://sampwiki.blast.hk/wiki/Query_Mechanism (Thank westie for this )

Can use it in pretty much any language which supports UDP handling.

yeah that's the page i used to know how to get the information from the packages. i will include package c,d and p too in future.
Reply
#9

Hmm... I think I need to restart documentating the protocol, eh? Instead of having rules being defined from 0 to 5, how about 0 to infinity? (well, 2^31 anyway). May I suggest vectors? Or even stringmaps? Also, wouldn't it be better to use some sort of boilerplate code instead of copy and pasting for each function?

Quote:
Originally Posted by CJ101
Quote:
Originally Posted by DavidC
Quote:
Originally Posted by Faraday
I don't get it, why would you need to get the info for weburl etc.. Just take a peek in server.cfg?
It gets the information from REMOTE servers, not your own. (Well you could use it to get your own server information, but not much point like you said).

Looks great, I would use it.....but I run linux. I also noticed there was a makefile in there, whats the point of including a makefile when the plugin requires a windows header file? Just curious
This could easily be abused - anyone could use this on any server.
Anyone can use the SA-MP client, or my Query include. Your point is?
Reply
#10

Quote:
Originally Posted by /^We(stie|z+[e|a
r)$/ ]
Hmm... I think I need to restart documentating the protocol, eh? Instead of having rules being defined from 0 to 5, how about 0 to infinity? (well, 2^31 anyway). May I suggest vectors? Also, wouldn't it be better to use some sort of boilerplate code instead of copy and pasting for each function?

Quote:
Originally Posted by CJ101
Quote:
Originally Posted by DavidC
Quote:
Originally Posted by Faraday
I don't get it, why would you need to get the info for weburl etc.. Just take a peek in server.cfg?
It gets the information from REMOTE servers, not your own. (Well you could use it to get your own server information, but not much point like you said).

Looks great, I would use it.....but I run linux. I also noticed there was a makefile in there, whats the point of including a makefile when the plugin requires a windows header file? Just curious
This could easily be abused - anyone could use this on any server.
Anyone can use the SA-MP client, or my Query include. Your point is?
Very good for communitys that have more than one gameserver, they can check current stats in another server.

Tested, works very well.

Reply
#11

Awesome.
Reply
#12

About the rules..

Not every server has the same set of rules..
The rules you that you said, are the default ones.
There's a plugin to edit the rules.

So the server can send any rule key and value (different from the default ones)
maybe you can implant that too? (I mean that you can get rules others then the default ones)
Reply
#13

This plugin can be easily used to DoS servers...

while(true) GetInfoPacket("127.0.0.1",7777);

Reply
#14

Quote:
Originally Posted by RoBo
This plugin can be easily used to DoS servers...

while(true) GetInfoPacket("127.0.0.1",7777);

So??, you can DoS with every socket/connection plugin that exists..
Even with php you can easily DoS servers..
Reply
#15

Quote:
Originally Posted by D00Mpy
Quote:
Originally Posted by RoBo
This plugin can be easily used to DoS servers...

while(true) GetInfoPacket("127.0.0.1",7777);

So??, you can DoS with every socket/connection plugin that exists..
Even with php you can easily DoS servers..
You don't even need a specialised script. We really need quantum network connections.
Reply
#16

Quote:
Originally Posted by RoBo
This plugin can be easily used to DoS servers...

while(true) GetInfoPacket("127.0.0.1",7777);

you don't need a while loop for the function GetInfoPacket.

Quote:

About the rules..

Not every server has the same set of rules..
The rules you that you said, are the default ones.
There's a plugin to edit the rules.

So the server can send any rule key and value (different from the default ones)
maybe you can implant that too? (I mean that you can get rules others then the default ones)

yes i will change it that you can get those rules too.
Reply
#17

Quote:
Originally Posted by Flag
Quote:
Originally Posted by RoBo
This plugin can be easily used to DoS servers...

while(true) GetInfoPacket("127.0.0.1",7777);

you don't need a while loop for the function GetInfoPacket.
he ment to use an unlimited loop to DoS a server...
Reply
#18

I doubt people are going to bother trying to use this to DoS servers, as most of them would wonder why one connection looping that code doesn't work.
Reply
#19

Could you reupload it as the archive is broken? (Or is it broken just for me?)
Reply
#20

works for me but i added a second mirror, hope this works for you too
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)