[Plugin] Isup plug-in
#1

Hello lads,

I figured it'd be better to introduce this system as a plug-in. Having it as an include relies on an API, and also is reliant on a web server to run whereas a plug-in can directly load the information.

Additionally, it will get the data from the server network itself so things such as ping, etc can be obtained from the local machine, and not the isup system.

Before I say anything else, I'd like to state that this uses a modified version of Cody Cumming's(by3t) C++ SA-MP query implementation mechanism. You can find that here:
https://sampforum.blast.hk/showthread.php?tid=437309

The include version can be found here: https://sampforum.blast.hk/showthread.php?tid=554654.

As of now there is simply one function:(EDIT: This is no longer the case.)

pawn Code:
native IsServerOnline(IP[], port=7777);
native set_ping_timeout(timeout);
native get_ping_timeout();
This function returns the ping(or 0 if unable to establish a connection) of the server.

I do plan on adding more natives allowing the user to get extra data such as playercount, connected player names(assuming it is less than 100 players), server version and more.

Example:
pawn Code:
#include <a_samp>
#include <isup>

public OnFilterScriptInit()
{
    new var;
    var = IsServerOnline("192.99.246.196", 7777);
   
    if(var)
    {
        printf("192.99.246.196:7777 is online.");
    }
   
    else
    {
        printf("192.99.246.196:7777 is offline.");
    }
   
    return true;
}
Bugs:

The only bug I found while testing is that if you use a hostname, the server will get an exception and crash. The fix for this is to just use the numeric IP address until the issue has been resolved.

UPDATE: This seems to be actually caused when an invalid IP addressed is passed. A IP validation check will be added in future versions, but for now be careful of the IP's you allow / place in the function.


This issue has been fixed - hostnames now should work properly. Additionally, invalid IP addresses / masks should no longer crash or hang the server.


Possible Uses:
This can be useful if you are a multi-server gaming community and you want to show users information / status of another one of the community's SA-MP servers.

Compilation Notes:
I have only built a binary for windows. You'll have to compile linux for yourself.

The download can be found here on github:
View on github(Click me)

(The github repository contains the source)

You can find a tutorial / documentary here. Additionally, all changes / downloads will be hosted on GitHub.

P.S: I have made a seperate repo that fixes Cody Cumming's original query a bit like this plugin does(allowing the use of hostnames while not crashing invalid IP addresses) which can be found here:
https://github.com/Abagail/sampquerycpp
Reply


Messages In This Thread
Isup plug-in - by Abagail - 28.02.2015, 20:37
Re: Isup plug-in - by ConnorHunter - 07.03.2015, 17:52
Re: Isup plug-in - by Abagail - 07.03.2015, 17:55
Re: Isup plug-in - by Rancho - 07.03.2015, 18:04
Re: Isup plug-in - by Abagail - 07.03.2015, 18:11
Re: Isup plug-in - by Rancho - 08.03.2015, 17:27
Re: Isup plug-in - by Abagail - 08.03.2015, 18:41
Re: Isup plug-in - by Abagail - 10.03.2015, 21:35
Re: Isup plug-in - by RebeloX - 10.03.2015, 21:44
Re: Isup plug-in - by Abagail - 10.03.2015, 21:48

Forum Jump:


Users browsing this thread: 1 Guest(s)