04.01.2015, 16:20
(
Последний раз редактировалось Abagail; 10.01.2015 в 17:25.
)
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:
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:
Direct Call Method example:
Well; here it is!
DOWNLOAD - VIEW IN BROWSER
DOWNLOAD - DIRECT DOWNLOAD
DOWNLOAD - VIEW IN BROWSER(VERSION 2)
Thanks.
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);
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;
}
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);
}
DOWNLOAD - VIEW IN BROWSER
DOWNLOAD - DIRECT DOWNLOAD
DOWNLOAD - VIEW IN BROWSER(VERSION 2)
Thanks.