Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Pobieranie nazwy serwera oraz rozgrywanej mapy [CS 1.6]
yank5532
post 18.10.2015, 19:05:26
Post #1





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 23.12.2014

Ostrzeżenie: (0%)
-----


Witam jak moge zrobic skrypt php zeby pobieral mi nazwe serwera oraz rozgrywana mape w grze conter-strike 1.6?
jesli jest opcja gotowego skryptu byl bym bardzo wdzieczny, pozdrawiam!
Go to the top of the page
+Quote Post
mizii
post 19.10.2015, 10:33:09
Post #2





Grupa: Zarejestrowani
Postów: 86
Pomógł: 1
Dołączył: 19.10.2015

Ostrzeżenie: (0%)
-----


troche odkopany z forum z 2004r trafilem na taki kod nie wiem czy dziala


  1. <?php
  2.  
  3. /**
  4. * pobiera informacje z serwera i zwraca tablice z tymi danymi
  5. *
  6. * @param string $intServerIP Adres IP serwera
  7. * @param integer $intServerPort Port serwera
  8. * @return array
  9. */
  10. function RetriveInfo ( $strServerIP = '127.0.0.1', $intServerPort = 27015 )
  11. {
  12. $connection = fsockopen( \"udp://\" . $strServerIP, $intServerPort );
  13. fwrite( $connection, sprintf( '%c%c%c%c%s%c', 0xFF, 0xFF, 0xFF, 0xFF, \"infostring\", 0x00 ) );
  14. fread( $connection, 24 );
  15. $status = socket_get_status( $connection );
  16. if ( $status[\"unread_bytes\"] != 0 )
  17. {
  18. $return = \"\";
  19. while ( $status[\"unread_bytes\"] != 0 )
  20. {
  21. $return .= fread( $connection, 1 );
  22. $status = socket_get_status( $connection );
  23. }
  24.  
  25. $return = explode( '', $return );
  26.  
  27. $arr = array();
  28. $arr['ip'] = $intServerIP;
  29. $arr['port'] = $intServerPort;
  30. $arr['hostname'] = $return[19];
  31. $arr['game'] = $return[17];
  32. $arr['players'] = $return[5];
  33. $arr['maxplayers'] = $return[11];
  34. $arr['system'] = ( $return[25] == \"w\" ) ? \"Windows\" : \"Linux\";
  35. $arr['game_dir'] = $return[15];
  36. $arr['map'] = $return[21];
  37. $arr['password'] = ( $return[25] == \"0\" ) ? false : true;
  38. $arr['secure'] = $return[29];
  39. return $arr;
  40. }
  41. else
  42. {
  43. // blad?
  44. return $arr;
  45. }
  46. }
  47. ?>


Go to the top of the page
+Quote Post
yank5532
post 19.10.2015, 21:39:44
Post #3





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 23.12.2014

Ostrzeżenie: (0%)
-----


Dziękuję bardzo ci za pomoc ale ten skrypt zbytnio nie zadziała pod większą ilość ip na stronie smile.gif
już mam swój skrypt kożystając z hlsocket ale i tak + smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 24.04.2024 - 18:13