xSkaSchY 0 Posted February 9, 2008 Hello Guys, im currently working on a new server monitoring plus web interface for a linux dedicated server. As soon it is possible i'll release a demo version. At this point of work i have a problem while fetching some player informations via udp sockets. Is it possible to get the player-id? Any suggestions? Greetigs Toby Share this post Link to post Share on other sites
jerryhopper 286 Posted February 9, 2008 there no way of grabbing the player-id via a server query. the only option is parsing the logfile. Share this post Link to post Share on other sites
xSkaSchY 0 Posted February 9, 2008 hey jerry, yes i currently use this way, but thats not the finest. Share this post Link to post Share on other sites
jerryhopper 286 Posted February 9, 2008 if i might ask, what do you use for parsing the logs? i have some unfinished python scripts that eventually would be part of a remote server tool. Do you wrote your tool in python or maybe perl? Share this post Link to post Share on other sites
xSkaSchY 0 Posted February 9, 2008 i write the GUI in PHP, and some scripts in bash, like start / stop. For parsing i use php too. its a very powerful language. by the way: the log file, server_console.log, r only up-to-date if the server restarts No live logs? Share this post Link to post Share on other sites
Sparrow1973 0 Posted February 10, 2008 I'm very interresting to know what are commands you sent to the dedicated server to get players names and others infos, port query... etc... are there theses informations somewhere ? Thanks a lot Share this post Link to post Share on other sites
xSkaSchY 0 Posted February 12, 2008 Here is a small sample: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> <?php $sHostaddr = '62.75.129.36'; $iPort = 2302; if ($iWaittime < 500) $iWaittime = 500; if ($iWaittime > 2000) $iWaittime = 2000; $iWaittime = doubleval($iWaittime / 1000.0); $rConnection = @fsockopen('udp://' . $sHostaddr, $iPort, &$iErrorNo, &$sErrorStr); if (!$rConnection) { die('Socket Error [' . $sHostaddr . ':' . $iPort. '] [' . $iErrorNo . '] - ' . $sErrorStr); } socket_set_blocking($rConnection, true); $sCommand = pack("c*",0xFE,0xFD,0x00,0x04,0x05,0x06,0x07,0xFF,0xFF,0xFF); $sSignature = pack("c*",0x00,0x04,0x05,0x06,0x07); $sHead = "player_\x00team_\x00score_\x00deaths_\x00\x00"; fwrite($rConnection, $sCommand, strlen($sCommand)); $iStarttime = microtime(true); $iDataLenght = 0; $sServerdata = ''; do { $sServerdata .= fgetc($rConnection); $iDataLenght++; $aMetaData = stream_get_meta_data($rConnection); if (microtime(true) > ($iStarttime + $iWaittime)) { $this->errmsg="contime"; fclose($rConnection); return false; } } while ($aMetaData["unread_bytes"]); $sServerdata = substr($sServerdata,strlen($sSignature)); $sGEnd = strpos($sServerdata, $sHead); $sGInfo = substr($sServerdata, 0, $sGEnd); $aGInfo = explode("\x00", $sGInfo); $sPEnd = strlen($sServerdata); $sPInfo = substr($sServerdata, $sGEnd+strlen($sHead), $sPEnd); $aPInfo = explode("\x00",$sPInfo); for ($i = 0; $i < count($aGInfo); $i = $i + 2) { $sKey = $aGInfo[$i]; if ($i + 1 >= count($aGInfo)) break; $sData = $aGInfo[$i+1]; if ($sKey != "\x00" && !empty($sData)) $aServerdata[$sKey] = $sData; } for ($i = 0; $i < count($aPInfo); $i=$i+4) { $sName = $aPInfo[$i]; if (!empty($sName)) { $aServerdata['player'][] = array( "name" => $sName, "team" => $aPInfo[$i+1], "score" => $aPInfo[$i+2], "deaths" => $aPInfo[$i+3] ); } } print '<pre>'; print_r($aServerdata); print '</pre>'; ?> Share this post Link to post Share on other sites
Sparrow1973 0 Posted February 14, 2008 Thanks I try to convert this php program, my application is under VB.NET... Share this post Link to post Share on other sites