Timeleft, nextmap, everything you want!!!

Server Information Script downloads, mappics, news and discussions.

Moderator: Clan Members

Timeleft, nextmap, everything you want!!!

Postby Psycke on 08 Oct 2007, 22:11

http://forum.un4given.nl/viewtopic.php?p=19030#19030
This post is mine at the link... I did start to write how to do it, but then my internet connection got lost :( And I have forgot about SI till today. Now, I'm giving you the tutorial, how to get the information out of your server. And I want to tell you, that new version of SI will be out later. With much easier use and stuff liek that, template system and so on.

Now about the timeleft and nextmap stuff.

Only file to edit is html/html.php

What do we need to change there? Basicly, we add our own <TD></TD> and stuff like that and then get out the value of the server.

1. We need to get the ID of the cvar which is needed for us, so, for example if you use medium display style, at function (data2medium), then here is the code:
function data2medium($data)
{
return "
". print_r($data) ." // THIS LINE WILL GIVE US ALL THE ARRAY INFO IN VERY BEAUTIFUL FORMATION :D !
<TABLE>
<TR><TH>" . $data["info"]["name"] . "</TH></TR>
<TR>
<TD><nobr>" .
$data["html"]["gameicon"] . " " .
$data["html"]["joinlink"] . " " .
$data["html"]["anticheaticon"] . " " .
$data["html"]["passwordicon"] . "</nobr></TD>
</TR>
<TR>
<TD>" . $data["html"]["mapimage"] . "</TD>
</TR>
<TR>
<TD> Map: " . $data["info"]["map"] . "</TD>
</TR>
<TR>
<TD> Nextmap: " . $data["rules"][13]["value"] . "</TD> // ID OF NEXTMAP IN ARRAY LIST IS 13 (IT DIFFERS FROM SERVER CONFIG)
</TR>
<TR>
<TD> Timeleft: " . $data["rules"][14]["value"] . "</TD> // ID OF TIMELEFT IN ARRAY LIST IS 14 (IT DIFFERS FROM SERVER CONFIG)
</TR>
<TR>
<TD>" .
$data["html"]["playericons"] . "</TD>
</TR>
</TABLE>";
}
(used quote here, because of much nicer formation then code tag have)
Okay, when the print_r($data) is written in the code, it will show us the array list in formation as:
[host] => 62.85.31.2:27015 [status] => up

Pretty suxish, but easy to understand. Because of default values as host, status and everything is already made in special variables as $data["info"]["name"], then we can ignore those lines.
We need those, which start with a number like:
[14] => Array ( [rule] => amx_timeleft [value] => 16:55 )

Here you can see, that the array ID 14 stands for amx_timeleft, and with the correct value.

Got the idea? ;) So, look at the ID, and then in the html.php just add it as:
". $data["rules"][YOUR ARRAY ID]["value"] ."


The tutorial is written pretty bad, but I think you will understand it. Got questions, just ask! And wait for the new version of SI :)

I want to mention again! The nextmap and timeleft values will differ from server configuration, so don't use mine. How much plugins amxx have, how much modules and everything, it's changing those values! Just print out the $data array and check for the value ID's, then start adding them in your SI html.php script.

Good luck, and I'm waiting for questions about this one, because the tutorial is bad, and I don't know how to improve it! And some feedback.. It's working/not.
Psycke
 
Posts: 3
Joined: 18 Jun 2007, 15:39
Location: Latvia, Riga


Return to Server Information Script


Who is online

Users browsing this forum: No registered users and 1 guest

cron