LeaderboardPost.php
Different trophies and awards can be given to the players on your servers.
This is managed through the following files: statsConfig.php, trophyPost.php, and trophies.txt.
For this all to work you must first upload the two php files given below onto a server that you own, and then set the following in your serverSettings.txt
leaderboardTrophyURL=http://abc.com/url/to/my/trophies.txt leaderboardTrophyPostURL=http://abc.com/url/to/my/trophyPost.php leaderboardPostPassword=myPassword
Then, when you want to give a bunny an award you must be a mod on your server and use the /trophy Console Commands.
For example: Typing ```/trophy playerID 1st``` will give that player a "1st" trophy. Whatever trophies you want are defined in this file. In the comments you can get an idea for what the trophies look like, and change it accordingly if you want your trophies to be different.
The trophy records are stored in a text file which is defined inside of statsConfig.php as shown below:
statsConfig.php
<?php $postPW = "myPassword"; $trophiesFile = 'trophies.txt'; ?>
In this case, trophies.txt is written to each time a trophy is awarded, and then trophies.txt is read by the server each time a new map loads so it can know who has trophies and will show their trophies next to their names respectively in the in-game leader boards.
trophyPost.php is what the server talks to when it is told to give a player a trophy. It processes the server message, and saves it to the trophies.txt file as necessary in the appropriate format. This example shows a single line in the trophies.txt file. This given player has 3 trophies of different kinds, but each happens to be green colored. Each player that has won trophies has their own line in the trophies file. playerName^playerID^b1:00ff00#b2:00ff00#a1:00ff00
trophyPost.php
<?php include("statsConfig.php"); if ($_GET["pw"] != $postPW) { exit; } //convert what the server told us happened, into some kind of "record or trophy" that can be displayed next to the player's name //the format is: playerName^playerID^b1:00ff00#b2:00ff00#a1:00ff00 //OBEY servers will read this and search it for players that are joining. //Each time they find the player's ID (the name is just for convenience of manual editing) it will display the award in the score board //a1 = a vertical line next to the name //a2 = a thick vertical line //a3 = a large cube //b1 = a small dot //b2 = 2 small dots , one over the other $trophy = $_GET["trophy"]; $profileID = $_GET["profileID"]; $playerName = $_GET["playerName"]; if ($profileID == "" || $playerName == "" || $trophy == "") exit; if ($trophy != "1st" && $trophy != "2nd" && $trophy != "3rd") { echo "[ff0000]Trophy not recognized.[-]"; //this will be printed to everyone on the server exit; } $data = file($trophiesFile); // reads an array of lines $recordExists = 0; $outData = array(); //below, we transcribe each line from $data into $outData, making any needed changes as we go. for ($i = 0; $i < Count($data); $i++) { if (strncmp($data[$i], $profileID, strlen($profileID)) === 0) //does the line starts with the profileID? { $recordExists = 1; //abcd2234^stuphChicken^b1:00ff00#b1:00ff00#b1:00ff00# //we may have a mix of dots.. so lets order them. First place on the left, 2nd markers in the middle, 3rds on the right. //count any we may have $firsts = (int)substr_count($data[$i], 'b1:00ff00'); $firsts += (int)substr_count($data[$i], 'b2:00ff00') * 2; $seconds = (int)substr_count($data[$i], 'b1:00ffff'); $seconds += (int)substr_count($data[$i], 'b2:00ffff') * 2; $thirds = (int)substr_count($data[$i], 'b1:008989'); $thirds += (int)substr_count($data[$i], 'b2:008989') * 2; //add the trophy given by the url if ($trophy == "1st") //won first place $firsts++; else if ($trophy == "2nd") $seconds++; else if ($trophy == "3rd") $thirds++; else { echo "[ff0000]Trophy not recognized.[-]"; //this will be printed to everyone on the server exit; } //reorganize and print all awards, so that they appear in order 1st, 2nd, 3rd place wins $awards = ""; for ($d = 0; $d < (int)floor($firsts/ 2); $d++) //firsts/2 in a way that will not round or cast to float $awards .= "b2:00ff00#"; if ($firsts % 2 == 1) $awards .= "b1:00ff00#"; for ($d = 0; $d < (int)floor($seconds/ 2); $d++) $awards .= "b2:00ffff#"; if ($seconds % 2 == 1) $awards .= "b1:00ffff#"; for ($d = 0; $d < (int)floor($thirds/ 2); $d++) $awards .= "b2:008989#"; if ($thirds % 2 == 1) $awards .= "b1:008989#"; $outData[Count($outData)] = $profileID."^".$playerName."^".$awards."\n"; } else if ($data[$i] != "" && $data[$i] != "\n" && $data[$i] != "\n\n") { $outData[Count($outData)] = $data[$i]; //nothing noted, just copy this line to the end of the output } } if ($recordExists == 0) //this is the first trophy for this player { if ($trophy == "1st") //won first place $outData[Count($outData)] = $profileID."^".$playerName."^b1:00ff00\n"; //add the new record else if ($trophy == "2nd") $outData[Count($outData)] = $profileID."^".$playerName."^b1:00ffff\n"; else if ($trophy == "3rd") $outData[Count($outData)] = $profileID."^".$playerName."^b1:008989\n"; } file_put_contents($awardsFile, implode("", $outData)); echo "[00ff00]". $playerName ." = ". $trophy."![-]"; //this will be printed to everyone on the server ?>