• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] OTServStatus 1.1

RobsonDias

New Member
Joined
Jun 17, 2009
Messages
455
Reaction score
3
Location
$this->Home()
Hello,

I developed a class in PHP to grab all the data from a server (Players, Maximum Players, Server Version, Client Version, Map Size, Monsters, NPCs, Server Name).
I'll be updating it whenever I have a new idea to implement. And I'm already working on a caching system to save data and only make new checks every 5 minutes (or more, will be configurable).

Examples:
PHP:
Include('class.otserv.php');

$OTServ = new OTServStatus();

$Connect = $OTServ->Connect('shadowcores.twifysoft.net', 7171);
if(!$Connect) {
  echo 'server offline';
} else {
    echo "{$OTServ->Players()} / {$OTServ->PlayersMax()}";
}

Current Functions
PHP:
$OTServ->Players() 
/* Get current number of players online. */

$OTServ->PlayersMax()
/* Returns max players online of server. */

$OTServ->ServerVersion()
/* Returns current distro version. (Ex: The Forgotten Server 0.4_DEV) */

$OTServ->Monsters()
/* Returns current total monsters on server. */

$OTServ->NPCs()
/* Returns current total number of npcs on server. */

$OTServ->UptimeHours()
/* Return current uptime hours. */

$OTServ->UptimeMinutes()
/* Returns current uptime minutes. */

$OTServ->MapWidth()
/* Returns server map width. */

$OTServ->MapHeight()
/* Returns server map height. */

$OTServ->ServerName()
/* Returns current server name. */

$OTServ->ClientVersion()
/* Returns current server client version (Ex: 8.62, 9.81) */

Download:
https://github.com/v0id5/OTServStatus

OBS: If you liked it, and you have some idea to implement in the project, post in this topic.
:ninja:
 
And what? What does this doe? Grab the info and dont show it anywhere? To me this sounds like a list of commands more like a tutorial since you dont use the information you get?

I can be wrong. :)
 
pretty nice, im interested in communication between c++ and php and between other plataforms like games or websites :)
 
echo "{$OTServ->Players()} / {$OTServ->PlayersMax()}";

You can just get some shit info about your server and echo with very simple lines

- - - Updated - - -

And what? What does this doe? Grab the info and dont show it anywhere? To me this sounds like a list of commands more like a tutorial since you dont use the information you get?

I can be wrong. :)

upp
 
And what? What does this doe? Grab the info and dont show it anywhere? To me this sounds like a list of commands more like a tutorial since you dont use the information you get?

I can be wrong. :)

This class prints some data of your server, u can add on your otserv website or create a website like otservlist, for example this is shadowcores status box.

ktnNjgq.png


With this class, you need only put this, and will be shown the number of players online
PHP:
echo "{$OTServ->Players()} players online.";
 

Attachments

Aah, really nice. Now, I hope someone makes a homepage like otservlist but better!
 
Today i have updated the class to a new version (v1.1), adding some new functions and fixing minor bugs.

Changelog:
Code:
Added $OTServ->ServerIP();
Added caching system, make new check only every 5 minutes (configurable)
Added some comments to otserv.class.php
Added Players Peak system, and automatic peak updates
Updated example.php to works with new version
 
Looks great, I might base on it or use it as a reference on some future updates of Znote AAC. :)
 
This script doesn't receive the list of players from servers.
And also It doesn't work in binary mode.


Good script and quite useful.
 
Looks great, I might base on it or use it as a reference on some future updates of Znote AAC. :)

No problems :)

This script doesn't receive the list of players from servers.
And also It doesn't work in binary mode.


Good script and quite useful.

There's no way to get the list of players online, because tfs does not send to status.cpp, that is the file that assembles the list of data we can get from a server.
 
Back
Top