Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (c) 2012 [iPs]TeaM
- * Bruno da Silva (email@brunodasilva.com)
- * Função básica para enviar um comando RCON (administrador) em servidor samp via sockets
- Ex :
- enviarComandoRCON("127.0.0.1", 7777, "TUASENHARCON", "exit");
- * www.brunodasilva.com
- * www.ips-team.forumeiros.com
- */
- function enviarComandoRCON($ip, $porta, $rcon, $cmd, $timeout = 5) {
- $packet = 'SAMP';
- $ipArr = explode('.', $ip);
- $packet .= chr($ipArr[0]) . chr($ipArr[1]) . chr($ipArr[2]) . chr($ipArr[3]) . chr($porta & 255) . chr($porta >> 8 & 255);
- $packet .= 'x'.chr(strlen($rcon) & 255).chr(strlen($rcon) >> 8 & 255).$rcon.chr(strlen($cmd) & 255).chr(strlen($cmd) >> 8 & 255) .$cmd;
- $socket = @fsockopen('udp://'.$ip, $porta, $erroval, $errostr, $timeout);
- if($socket) {
- fwrite($socket, $packet);
- fclose($socket);
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement