[Include] SA:MP IsUp Tool - API
#1

Greetings,

A while back I made an IsUp tool for SA:MP servers. Now I am introducting a beta SA:MP IsUp API. Its not perfect, and may have bugs as I tested it as fast as I could without totally screwing everything up.

It isn't the easiest to use; how-ever it shouldn't be that hard either. It has a few key functions which can be found below:

pawn Код:
public LoadServerInformation(ip[], port);
pawn Код:
stock IsServerOnline(index);
pawn Код:
stock ReleaseIndex(index);
You first have to load the server information using LoadServerInformation. Then; you'll have to use a timer or another method of waiting. I'd recommend waiting around 2 seconds, how-ever it may need a longer time depending on the ping it gets to the site. Then you'll use IsServerOnline which returns either true or false. Ofcourse, if online true is returned.

And don't forget to use ReleaseIndex when you're done using it.

Heres an example FS:
pawn Код:
#include <a_samp>
#include <serverdata>

public OnFilterScriptInit()
{
    new index = LoadServerInformation("server.ls-rp.com", 7777);
    return 1;
}

forward ServerIP_Process(index);
public ServerIP_Process(index)
{
    new bool: isonline = IsServerOnline(index);
    if(isonline == true)
    {
        print("server.ls-rp.com:7777 is online!");
    }
    else
    {
        print("server.ls-rp.com:7777 is not online!");
    }
    ReleaseIndex(index);
    return 1;
}
Direct Call Method example:
pawn Код:
#include <a_samp>
#include <serverdata>

public OnFilterScriptInit()
{
    new index = LoadServerInformation("server.ls-rp.com", 7777);
    return 1;
}

public ServerInformation_OnResponse(index, bool: IsOnline)
{
    if(IsOnline)
    {
        print("server.ls-rp.com:7777 is online!");
    }
    else
    {
        print("server.ls-rp.com:7777 is not online!");
    }
    ReleaseIndex(index);
}
Well; here it is!
DOWNLOAD - VIEW IN BROWSER
DOWNLOAD - DIRECT DOWNLOAD

DOWNLOAD - VIEW IN BROWSER(VERSION 2)

Thanks.
Reply


Messages In This Thread
SA:MP IsUp Tool - API - by Abagail - 04.01.2015, 16:20
Re: SA:MP IsUp Tool - API - by Kaperstone - 04.01.2015, 16:24
Re: SA:MP IsUp Tool - API - by Abagail - 04.01.2015, 16:26
Re: SA:MP IsUp Tool - API - by Lordzy - 04.01.2015, 16:36
Re: SA:MP IsUp Tool - API - by Abagail - 04.01.2015, 16:46
Re: SA:MP IsUp Tool - API - by Lordzy - 04.01.2015, 16:54
Re: SA:MP IsUp Tool - API - by Abagail - 04.01.2015, 17:16
Re: SA:MP IsUp Tool - API - by Djole1337 - 04.01.2015, 17:20
Re: SA:MP IsUp Tool - API - by Abagail - 04.01.2015, 17:22
Re: SA:MP IsUp Tool - API - by Djole1337 - 04.01.2015, 17:25
Re: SA:MP IsUp Tool - API - by Abagail - 04.01.2015, 17:28
Re: SA:MP IsUp Tool - API - by Djole1337 - 04.01.2015, 17:35
Re: SA:MP IsUp Tool - API - by Abagail - 04.01.2015, 17:41
Re: SA:MP IsUp Tool - API - by Abagail - 05.01.2015, 23:47
Re: SA:MP IsUp Tool - API - by ViperAssasin11 - 06.01.2015, 00:35
Re: SA:MP IsUp Tool - API - by Abagail - 06.01.2015, 00:47
Re: SA:MP IsUp Tool - API - by Ryan_Bowe - 07.01.2015, 17:03
Re: SA:MP IsUp Tool - API - by Abagail - 07.01.2015, 17:14
Re: SA:MP IsUp Tool - API - by nickdodd25 - 07.01.2015, 17:53
Re: SA:MP IsUp Tool - API - by Abagail - 07.01.2015, 17:56

Forum Jump:


Users browsing this thread: 1 Guest(s)