404 Posted November 20, 2004 Share Posted November 20, 2004 (edited) I am new to the GTA PC world, I got the game about 2 weeks ago and started playing it then started moding it and found MTA and was like, "oh cool". So I played it for a few days then I started to browse the forums and got an idea to make a php script to fetch server stats. As I was browsing the forum I noticed that someone made on a while back and I saw another topic that said he didn't update it anymore. So that brings me to this, my first post and a php script to fetch stats. I am pretty much done with the coding part (I used the existing code and modified it pretty good). Though as I started to test it out on different servers it did not work so I will have to make like a config file for it. You can look at it now right here: http://ninezeronine.net/404/gtaserver.php. Please post any questions/comments you have. ////Edit//// 11/20/04 - 6:07 EST I made a lot of progress and the release that I had hoped for today just isn't going to happen, while the script works great on some servers it looks horrible on others. I am trying to resolve a salution to fix this, check back for updates. Also any request you want please post them. ////Edit//// 11/21/04 - 6:50 EST Okay, I think I fixed the bugs but am not totally sure, tested it on the top 10 servers and a few others and it worked okay. One thing is that it does not work on any MTA Server < 0.4.1 or with GTA3 servers. If I get enough request I can make compatible version. Anyway here is the link and have fun, questions, comments and suggestions welcome. http://www.ninezeronine.net/404/mta.php Edited November 22, 2004 by Guest Link to comment
Bob_TDH Posted November 20, 2004 Share Posted November 20, 2004 Finally somebody decided to work on stat for mta servers. Everybody knows that statistic that dusty made for mta0.2.2 is too old for mta 0.4, so I thing you should continue your work and good luck with coding it Link to comment
DJ GTA Posted November 20, 2004 Share Posted November 20, 2004 Good Job, but the score seems to be off..or it looks like the ping am not sure . Maybe add a cool design and zip it, i bet lots of people would use it, Good Luck. Link to comment
404 Posted November 20, 2004 Author Share Posted November 20, 2004 Yeah I noticed last night that it was a little off, I will have to work on that. Link to comment
Niels Posted November 28, 2004 Share Posted November 28, 2004 this is my config file: <?php ///////////////////////////////////////////////////////////////// // MTA Sever Stat Fetcher 1.0 // // http://www.ninezeronine.net/404 // // [email protected] // // gtaconfig.php // // Copyright (C) 2004 Justin Court // //////////////////////////////////////////////////////////////// //////////----Start Config----////////// $ServerIP = "24.132.106.135"; $ServerPort = "2003"; $serverArr = 2; $mapArr = 4; $verArr = 5; $curUserArr = 7; $maxUserArr = 8; $displayPlayers = 1; //1=yes, 0=no $displayScore = 1; //1=yes, 0=no $displayPing = 1; //1=yes, 0=no $displayMap = 1; //1=yes, 0=no $displayMTAVersion = 1; //1=yes, 0=no $displayServerAndPort = 1; //1=yes, 0=no $useMTAHandler = 1; //1=yes, 0=no $numStart = 1; //1=start at one, 0 start at zero $displayLeadingZero = 1; //1=yes, 0=no $table1color = "#C0C0C0"; $table2color = "#FFFFFF"; $tableBorderColor = "#000000"; ///////////----End Config----/////////// //////////--Do Not Edit Below This Unless You Know What You Are Doing--////////// $fp = fsockopen("udp://" . $ServerIP, $ServerPort + 123, $errno, $errstr); if (!$fp) { echo "$errstr ($errno) \n"; exit; } else { fputs ($fp, "s"); $c = ''; do { $c .= fread ($fp,1); $fpstatus = socket_get_status($fp); } while ($fpstatus["unread_bytes"] ); fclose ($fp); $playerquery = strchr($c,"?"); $serverquery = substr($c,0, strlen($c) - strlen($playerquery)); $players = explode("?",$playerquery); unset($players[0]); // Remove Array number 0 because nothing is entered by explode. $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("%","",$serverquery); for($i=0;$i<(count($serverquery));$i++){ $explodedata = explode("<=>",$serverquery); } } $server_name = str_replace($ServerPort,"",$explodedata[$serverArr]); ?> and it's not working i have port 123 free on the server pc Link to comment
Mike Posted November 28, 2004 Share Posted November 28, 2004 Dang, i really wanted to use this but it's not for GTA3 Request! Link to comment
Niels Posted November 28, 2004 Share Posted November 28, 2004 what is the correct config i have gta vc server Link to comment
Niels Posted November 28, 2004 Share Posted November 28, 2004 i have it 100000xxx please help..... Link to comment
Mike Posted November 28, 2004 Share Posted November 28, 2004 (edited) This may be of help to some people: <?php ///////////////////////////////////////////////////////////////// // MTA Sever Stat Fetcher 1.0 // // http://www.ninezeronine.net/404 // // gtaconfig.php // // Copyright (C) 2004 Justin Court // //////////////////////////////////////////////////////////////// //////////----Start Config----////////// $ServerIP = "217.170.21.65"; $ServerPort = "2004"; $serverArr = 2; $mapArr = 4; $verArr = 3; $curUserArr = 5; $maxUserArr = 6; $displayPlayers = 1; //1=yes, 0=no $displayScore = 1; //1=yes, 0=no $displayPing = 1; //1=yes, 0=no $displayMap = 1; //1=yes, 0=no $displayMTAVersion = 1; //1=yes, 0=no $displayServerAndPort = 1; //1=yes, 0=no $useMTAHandler = 1; //1=yes, 0=no $numStart = 1; //1=start at one, 0 start at zero $displayLeadingZero = 1; //1=yes, 0=no $table1color = "#C0C0C0"; $table2color = "#FFFFFF"; $tableBorderColor = "#000000"; ///////////----End Config----/////////// //////////--Do Not Edit Below This Unless You Know What You Are Doing--////////// $fp = fsockopen("udp://" . $ServerIP, $ServerPort + 123, $errno, $errstr); if (!$fp) { echo "$errstr ($errno) \n"; exit; } else { fputs ($fp, "s"); $c = ''; do { $c .= fread ($fp,1); $fpstatus = socket_get_status($fp); } while ($fpstatus["unread_bytes"] ); fclose ($fp); $playerquery = strchr($c,"?"); $serverquery = substr($c,0, strlen($c) - strlen($playerquery)); $players = explode("?",$playerquery); unset($players[0]); // Remove Array number 0 because nothing is entered by explode. $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("%","",$serverquery); for($i=0;$i<(count($serverquery));$i++){ $explodedata = explode("<=>",$serverquery); } } $server_name = str_replace($ServerPort,"",$explodedata[$serverArr]); ?> BTW I got it working for the stats for my GTA3 Server - the only prob is that it says Vice City Stunt for map instead of Portland, everything else seems to work fine Edit: Here's My Stats Page Edit2: Here's My Stats Setup Page Edited November 28, 2004 by Guest Link to comment
Niels Posted November 28, 2004 Share Posted November 28, 2004 http://members.lycos.nl/warland/serverstats he says 0 i have port 2003 and 123 free on my router Link to comment
404 Posted November 28, 2004 Author Share Posted November 28, 2004 Could I request you pull my email addy out of the config.php scripts you posted? I don't want any spam bots Link to comment
404 Posted November 28, 2004 Author Share Posted November 28, 2004 this is my config file: <?php ///////////////////////////////////////////////////////////////// // MTA Sever Stat Fetcher 1.0 // // http://www.ninezeronine.net/404 // // gtaconfig.php // // Copyright (C) 2004 Justin Court // //////////////////////////////////////////////////////////////// //////////----Start Config----////////// $ServerIP = "24.132.106.135"; $ServerPort = "2003"; $serverArr = 2; $mapArr = 4; $verArr = 5; $curUserArr = 7; $maxUserArr = 8; $displayPlayers = 1; //1=yes, 0=no $displayScore = 1; //1=yes, 0=no $displayPing = 1; //1=yes, 0=no $displayMap = 1; //1=yes, 0=no $displayMTAVersion = 1; //1=yes, 0=no $displayServerAndPort = 1; //1=yes, 0=no $useMTAHandler = 1; //1=yes, 0=no $numStart = 1; //1=start at one, 0 start at zero $displayLeadingZero = 1; //1=yes, 0=no $table1color = "#C0C0C0"; $table2color = "#FFFFFF"; $tableBorderColor = "#000000"; ///////////----End Config----/////////// //////////--Do Not Edit Below This Unless You Know What You Are Doing--////////// $fp = fsockopen("udp://" . $ServerIP, $ServerPort + 123, $errno, $errstr); if (!$fp) { echo "$errstr ($errno) \n"; exit; } else { fputs ($fp, "s"); $c = ''; do { $c .= fread ($fp,1); $fpstatus = socket_get_status($fp); } while ($fpstatus["unread_bytes"] ); fclose ($fp); $playerquery = strchr($c,"?"); $serverquery = substr($c,0, strlen($c) - strlen($playerquery)); $players = explode("?",$playerquery); unset($players[0]); // Remove Array number 0 because nothing is entered by explode. $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("","<=>",$serverquery); $serverquery = str_replace("%","",$serverquery); for($i=0;$i<(count($serverquery));$i++){ $explodedata = explode("<=>",$serverquery); } } $server_name = str_replace($ServerPort,"",$explodedata[$serverArr]); ?> and it's not working i have port 123 free on the server pc What OS are you running and do you have PHP installed? Link to comment
Mike Posted November 28, 2004 Share Posted November 28, 2004 Could I request you pull my email addy out of the config.php scripts you posted? I don't want any spam bots Done Link to comment
Harry Posted November 29, 2004 Share Posted November 29, 2004 @MTAfreak: Does your host provide any PHP functionality? Looks like they don't... Link to comment
Bob_TDH Posted November 29, 2004 Share Posted November 29, 2004 Great Job 404!!! I'm using it for gta.ru server ---http://www.tdhklan.dp.ua/modules.php?name=stats Also if u good enough with coding can u do stat for servers like dusty did, here is example --- http://www.gta.ru/stats/ The problem is his stat is too old and it supports mta0.4.1 very badly . Most of the Russian players ask for that stat, so please if smbd good at coding do it. Thank You Link to comment
Harry Posted November 29, 2004 Share Posted November 29, 2004 That kind of stuff is very easy if Aeron and/or Oli would include a MySQL logging package, then all stats are easy available. Like http://130.89.167.192/mta Link to comment
Niels Posted November 29, 2004 Share Posted November 29, 2004 http://mbstats.jarnosloot.nl/ Link to comment
Harry Posted November 29, 2004 Share Posted November 29, 2004 Guess that's lightbulb, and not MTAMA... Link to comment
404 Posted November 29, 2004 Author Share Posted November 29, 2004 I would try and do kills like that, I know I could in PHP if the server outputted it, if not maybe one of the MTAmA people could make it output then you could display it with php and even log it into SQL, I am very new to the whole GTA: MTA scene so I am not too fond of the server and such yet. Link to comment
404 Posted November 29, 2004 Author Share Posted November 29, 2004 This is for all the people who want to display the stats of their favorite server or their server if they dont have root access or what not, I ran accross this site that gives free PHP hosting. Here is the link, http://www.nextdesigns.net/hosting.html. Enjoy Link to comment
Niels Posted November 30, 2004 Share Posted November 30, 2004 Server Name: J*MB* Public Server (MTA.0.4.1) Server Stats: http://mbstats.jarnosloot.nl Server Map: Vice City: Deathmatch MTA Version: 0.4.1 Current Players: 0 Max Players: 8 mta://24.132.106.135:2003 ID Nick Score Ping is j een bug ? Link to comment
404 Posted November 30, 2004 Author Share Posted November 30, 2004 For some odd enough reason, It sometimes displays a character before the server name, still working on this issue. Link to comment
dusty Posted December 11, 2004 Share Posted December 11, 2004 Well Bob, the story behind my lack of updates for my stats script is pretty much being swamped at work.. I just didn't have time to do it anymore, I didn't have time to maintain my server anymore and I could think of better things to do with $200+ a month instead of paying for a server I didn't use much. I wouldn't mind tinkering with the script some to get it running again in the latest version whenever I get a chance if someone would like to donate some web space. I have a domain for the script that I planned on using (I believe it was mtastats.com, but I'd have to double check). I'd prefer a unix system that can run a mta server for testing purposes. Needs MySQL and PHP of course. If anyone is interested my e-mail address is dusty at cox dot net. Link to comment
Recommended Posts