This one brings up a scoreboard of matches won at the beginning of ever match.
Code: Select all
#!/usr/bin/php
<?php
$dir = "http://95.154.207.220/maps/McWellob/logs/"; //the directory location of the file
$file = "won_matches.txt"; //the file you will rotate
// Your border colors. Add/remove lines as you please.
// Add a color multiple times to make it appear more often, or only once to make it rare.
// Example: 1/16 (6.25%); 3/16 (18.75%); 8/16 (50%)
$color_border = array("0xooff44", // 1.blue
"0xooff44", // 2.blue again
"0xooff44", // 3.blue once more
"0xooff44", // 4.gray
"0xooff44", // 5.gray again
"0xooff44", // 6.gray once more
"0xooff44", // 7.red
"0xooff44", // 8.red again
"0xooff44", // 9.green
"0xooff44", // 10.green again
"0xooff44", // 11.cyan border+purple text
"0xooff44", // 12.yellow
"0xooff44", // 13.gray (inverted)
"0xooff44", // 14.blue (inverted)
"0xooff44", // 15.red (inverted)
"0xooff44"); // 16.green (inverted)
// Your text colors - same amount and order as the border colors, otherwise wtf broken.
$color_text = array("0xffff00", // 1.blue
"0xffff00", // 2.blue again
"0xffff00", // 3.blue once more
"0xffff00", // 4.gray
"0xffff00", // 5.gray again
"0xffff00", // 6.gray once more
"0xffff00", // 7.red
"0xffff00", // 8.red again
"0xffff00", // 9.green
"0xffff00", // 10.green again
"0xffff00", // 11.cyan border+purple text
"0xffff00", // 12.yellow
"0xffff00", // 13.gray (inverted)
"0xffff00", // 14.blue (inverted)
"0xffff00", // 15.red (inverted)
"0xffff00"); // 16.green (inverted)
$trigger = "NEW_MATCH";
$file = $dir.$file;
while (1)
{
$line = rtrim( fgets(STDIN) );
if (feof(STDIN))
break;
$part = explode(" ", $line);
if ($part[0] == $trigger)
{
$fp = fopen($file, 'r');
$colornumber = mt_rand(0, count($color_border)-1); // randomizer by Titanoboa,
$color_1 = $color_border[$colornumber]; // anyone may use or modify
$color_2 = $color_text[$colornumber]; // as they please. \(¤_¤)/
$board = "{$color_1}***********************************************************" . '\\n';
$board .= "{$color_1}*************** {$color_2}Top 10 Craziest Inmates {$color_1}*****************" . '\\n';
$board .= "{$color_1}***********************************************************" . '\\n';
$board .= "{$color_1}** {$color_2}RANK {$color_1}*** {$color_2}PLAYER {$color_1}*** {$color_2}WINS {$color_1}**" . '\\n';
$board .= "{$color_1}***********************************************************" . '\\n';
for ($i = 0; $i < 10; $i++)
{
$log = fgets($fp);
if (feof($fp))
break;
list($wins, $player) = preg_split('/\s+/', $log);
$rank = $i + 1;
$space_rank = 6 - strlen($rank);
$space_wins = 7 - strlen($wins);
$space_player = 23 - strlen( stripcslashes($player) );
$board .= "{$color_1}** {$color_2}{$rank}" . str_repeat(" ", $space_rank) . "{$color_1}*** {$color_2}" . stripslashes($player) . str_repeat(" ", $space_player) . "{$color_1}*** {$color_2}{$wins}" . str_repeat(" ", $space_wins) . "{$color_1}**" . '\\n';
}
$board .= "{$color_1}***********************************************************";
fclose($fp);
console_message($board);
}
}
function console_message($message)
{
echo "CONSOLE_MESSAGE {$message}" . "\n";
}
?>
Code: Select all
#!/usr/bin/php
<?php
$dir = "/home/duke/aa/servers/McWellob/var/"; //the directory location of the file
$file = "rounds_won.txt"; //the file you will rotate
// Your border colors. Add/remove lines as you please.
// Add a color multiple times to make it appear more often, or only once to make it rare.
// Example: 1/16 (6.25%); 3/16 (18.75%); 8/16 (50%)
$color_border = array("0x444488", // 1.blue
"0x444488", // 2.blue again
"0x444488", // 3.blue once more
"0x888888", // 4.gray
"0x888888", // 5.gray again
"0x888888", // 6.gray once more
"0x884444", // 7.red
"0x884444", // 8.red again
"0x448844", // 9.green
"0x448844", // 10.green again
"0x448888", // 11.cyan border+purple text
"0x888844", // 12.yellow
"0xaaaaaa", // 13.gray (inverted)
"0x8888bb", // 14.blue (inverted)
"0xbb8888", // 15.red (inverted)
"0x88bb88"); // 16.green (inverted)
// Your text colors - same amount and order as the border colors, otherwise wtf broken.
$color_text = array("0x8888bb", // 1.blue
"0x8888bb", // 2.blue again
"0x8888bb", // 3.blue once more
"0xdddddd", // 4.gray
"0xdddddd", // 5.gray again
"0xdddddd", // 6.gray once more
"0xbb8888", // 7.red
"0xbb8888", // 8.red again
"0x88bb88", // 9.green
"0x88bb88", // 10.green again
"0x8888bb", // 11.cyan border+purple text
"0xbbbb88", // 12.yellow
"0x888888", // 13.gray (inverted)
"0x444488", // 14.blue (inverted)
"0x884444", // 15.red (inverted)
"0x448844"); // 16.green (inverted)
$trigger = "/rounds";
$file = $dir.$file;
while (1)
{
$line = rtrim( fgets(STDIN) );
if (feof(STDIN))
break;
$part = explode(" ", $line);
if ($part[1] == $trigger)
{
$fp = fopen($file, 'r');
$colornumber = mt_rand(0, count($color_border)-1); // randomizer by Titanoboa,
$color_1 = $color_border[$colornumber]; // anyone may use or modify
$color_2 = $color_text[$colornumber]; // as they please. \(¤_¤)/
$board = "{$color_1}***********************************************************" . '\\n';
$board .= "{$color_1}*************** {$color_2}Top 10 Match Winners {$color_1}*****************" . '\\n';
$board .= "{$color_1}***********************************************************" . '\\n';
$board .= "{$color_1}** {$color_2}RANK {$color_1}*** {$color_2}PLAYER {$color_1}*** {$color_2}WINS {$color_1}**" . '\\n';
$board .= "{$color_1}***********************************************************" . '\\n';
for ($i = 0; $i < 10; $i++)
{
$log = fgets($fp);
if (feof($fp))
break;
list($wins, $player) = preg_split('/\s+/', $log);
$rank = $i + 1;
$space_rank = 6 - strlen($rank);
$space_wins = 7 - strlen($wins);
$space_player = 23 - strlen( stripcslashes($player) );
$board .= "{$color_1}** {$color_2}{$rank}" . str_repeat(" ", $space_rank) . "{$color_1}*** {$color_2}" . stripslashes($player) . str_repeat(" ", $space_player) . "{$color_1}*** {$color_2}{$wins}" . str_repeat(" ", $space_wins) . "{$color_1}**" . '\\n';
}
$board .= "{$color_1}***********************************************************";
fclose($fp);
console_message($board);
}
}
function console_message($message)
{
echo "CONSOLE_MESSAGE {$message}" . "\n";
}
?>
Code: Select all
#!/usr/bin/php
<?php
$dir = "/home/duke/aa/servers/McWellob/var/"; //the directory location of the file
$file = "ladder.txt"; //the file you will rotate
// Your border colors. Add/remove lines as you please.
// Add a color multiple times to make it appear more often, or only once to make it rare.
// Example: 1/16 (6.25%); 3/16 (18.75%); 8/16 (50%)
$color_border = array("0x444488", // 1.blue
"0x444488", // 2.blue again
"0x444488", // 3.blue once more
"0x888888", // 4.gray
"0x888888", // 5.gray again
"0x888888", // 6.gray once more
"0x884444", // 7.red
"0x884444", // 8.red again
"0x448844", // 9.green
"0x448844", // 10.green again
"0x448888", // 11.cyan border+purple text
"0x888844", // 12.yellow
"0xaaaaaa", // 13.gray (inverted)
"0x8888bb", // 14.blue (inverted)
"0xbb8888", // 15.red (inverted)
"0x88bb88"); // 16.green (inverted)
// Your text colors - same amount and order as the border colors, otherwise wtf broken.
$color_text = array("0x8888bb", // 1.blue
"0x8888bb", // 2.blue again
"0x8888bb", // 3.blue once more
"0xdddddd", // 4.gray
"0xdddddd", // 5.gray again
"0xdddddd", // 6.gray once more
"0xbb8888", // 7.red
"0xbb8888", // 8.red again
"0x88bb88", // 9.green
"0x88bb88", // 10.green again
"0x8888bb", // 11.cyan border+purple text
"0xbbbb88", // 12.yellow
"0x888888", // 13.gray (inverted)
"0x444488", // 14.blue (inverted)
"0x884444", // 15.red (inverted)
"0x448844"); // 16.green (inverted)
$trigger = "/ladder";
$file = $dir.$file;
while (1)
{
$line = rtrim( fgets(STDIN) );
if (feof(STDIN))
break;
$part = explode(" ", $line);
if ($part[1] == $trigger)
{
$fp = fopen($file, 'r');
$colornumber = mt_rand(0, count($color_border)-1); // randomizer by Titanoboa,
$color_1 = $color_border[$colornumber]; // anyone may use or modify
$color_2 = $color_text[$colornumber]; // as they please. \(¤_¤)/
$board = "{$color_1}***********************************************************" . '\\n';
$board .= "{$color_1}*************** {$color_2}Top 10 Match Winners {$color_1}*****************" . '\\n';
$board .= "{$color_1}***********************************************************" . '\\n';
$board .= "{$color_1}** {$color_2}RANK {$color_1}*** {$color_2}PLAYER {$color_1}*** {$color_2}WINS {$color_1}**" . '\\n';
$board .= "{$color_1}***********************************************************" . '\\n';
for ($i = 0; $i < 10; $i++)
{
$log = fgets($fp);
if (feof($fp))
break;
list($wins, $player) = preg_split('/\s+/', $log);
$rank = $i + 1;
$space_rank = 6 - strlen($rank);
$space_wins = 7 - strlen($wins);
$space_player = 23 - strlen( stripcslashes($player) );
$board .= "{$color_1}** {$color_2}{$rank}" . str_repeat(" ", $space_rank) . "{$color_1}*** {$color_2}" . stripslashes($player) . str_repeat(" ", $space_player) . "{$color_1}*** {$color_2}{$wins}" . str_repeat(" ", $space_wins) . "{$color_1}**" . '\\n';
}
$board .= "{$color_1}***********************************************************";
fclose($fp);
console_message($board);
}
}
function console_message($message)
{
echo "CONSOLE_MESSAGE {$message}" . "\n";
}
?>
Any help would be greatly appreciated.