|
|
|
|
|
|
|
Re: FDS Status Reporter Plugin doesnt work [message #310130 is a reply to message #244166] |
Sat, 12 January 2008 04:46 |
|
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
The latest version of the plugin ( http://new.brenbot.com ) should work fine with 1.52, if it does not let me know and I will look into it. As for PHP side stuff, I'm afraid your just going to have to write your own PHP code for it, but this snippet should help;
// Process server data
if ( $fdsStatusTXT = file_get_contents ( "fdsstatus.txt" ) )
{
$fdsStatusArray = explode ( "\n", $fdsStatusTXT );
// Create gameData array
$gameData = array (
'mode' => $fdsStatusArray[0],
'map' => $fdsStatusArray[1],
'gdi_players' => $fdsStatusArray[2],
'gdi_points' => $fdsStatusArray[3],
'nod_players' => $fdsStatusArray[4],
'nod_points' => $fdsStatusArray[5],
'max_players' => $fdsStatusArray[6],
'timeleft' => $fdsStatusArray[7],
'sfps' => $fdsStatusArray[8]
);
// Create playerData array
for ( $i = 0; $i < $gameData['gdi_players']+$gameData['nod_players']; $i++ )
{
// Explode the appropriate index of $fdsStatusArray into itself
$fdsStatusArray[$i+9] = explode ( "\t", $fdsStatusArray[$i+9] );
// Adjust time field
$fdsStatusArray[$i+9][6] = substr ( $fdsStatusArray[$i+9][6], strpos( $fdsStatusArray[$i+9][6], "." )+1 );
$playerData[$i] = array (
'name' => trim($fdsStatusArray[$i+9][0]),
'side' => trim($fdsStatusArray[$i+9][1]),
'score' => trim($fdsStatusArray[$i+9][2]),
'kills' => trim($fdsStatusArray[$i+9][3]),
'deaths' => trim($fdsStatusArray[$i+9][4]),
'ping' => trim($fdsStatusArray[$i+9][5]),
'time' => trim($fdsStatusArray[$i+9][6])
);
}
}
(NOTE: The above PHP code is untested, but should work, or at least give you a good idea of how to make it work.)
[Updated on: Sat, 12 January 2008 15:01] Report message to a moderator
|
|
|
|
Re: FDS Status Reporter Plugin doesnt work [message #310272 is a reply to message #244166] |
Sat, 12 January 2008 15:03 |
|
danpaul88
Messages: 5795 Registered: June 2004 Location: England
Karma: 0
|
General (5 Stars) |
|
|
NB: Edited the above to replace $i with $i+9 on the line below the comment "// Adjust time field". As for why you need to adjust the time field, I am not entirely sure, but it was in the old code so I kept it. IIRC it was so that it could be parsed as a float for entry into a MySQL database (The $playerData and $gameData arrays don't exist in the live version TK2 use, it just goes straight into a database, but I replaced it with those to make it more clear what everything is).
|
|
|