Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2. /**
  3. * Created with ♥ by Verlikylos on 13.08.2017 23:49.
  4. * Visit www.verlikylos.pro for more.
  5. * Copyright © vMCShop 2017
  6. */
  7.  
  8. require APPPATH.'libraries/SourceQuery/bootstrap.php';
  9.  
  10. function rconCommand($commands, $player, $ip, $rconPort, $rconPass) {
  11. $Query = new \xPaw\SourceQuery\SourceQuery();
  12.  
  13. try {
  14. $Query->Connect($ip, $rconPort, 1, \xPaw\SourceQuery\SourceQuery::SOURCE);
  15.  
  16. $Query->SetRconPassword($rconPass);
  17.  
  18. foreach ($commands as $command) {
  19. $Query->Rcon(str_replace('{PLAYER}', $player, $command));
  20. }
  21.  
  22. return array('value' => true, 'message' => 'Polecenia zostały pomyślnie wysłane na serwer');
  23. } catch (Exception $e) {
  24. return array('value' => false, 'message' => 'Wystąpił błąd podczas komunikacji z serwerem!');
  25. } finally {
  26. $Query->Disconnect();
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement