Jump to content

AirNew

Members
  • Posts

    21
  • Joined

  • Last visited

1 Follower

About AirNew

  • Birthday March 29

Details

  • Gang
    No
  • Location
    Brazil
  • Occupation
    Server owner
  • Interests
    Nothing

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

AirNew's Achievements

Civilian

Civilian (7/54)

1

Reputation

  1. Sim, entrei em contato com a host, ele estava bloqueando alguns pacotes UDP e isso tava prejudicando!
  2. i'm from BRAZIL, and not speak english (just write)
  3. callRemote("https://bvbserver.com/MTA/file.php", callbackfnc, to, from, title, body) Wait, HTTPS://, WAIT WAIT WAIT
  4. I looked everywhere in the email, even in the session "All emails" but I did not find anything!
  5. I need help to send an email to the player using callRemote, my site is bvbserver.com I already have some more php files I do not know where it is wrong! RESOURCE ( X ) V - client.lua - V to = "[email protected]" from = "[email protected]" title = "TEST" body = "TESTMESSAGE" triggerServerEvent("sendMessage", getLocalPlayer(), to, from, title, body ) V - server.lua - V addEvent("sendMessage", true) addEventHandler("sendMessage", getRootElement(), function ( to, from, title, body ) local function callbackfnc(result, msg) outputDebugString("callbackfnc: " .. result .. " (" .. msg .. ")") end outputChatBox ( ""..to.." : "..from.." : "..title.." : "..body.."!", root ) callRemote("https://bvbserver.com/MTA/file.php", callbackfnc, to, from, title, body) end) --------------------------------- // --------------------------------- --------------------------------- // --------------------------------- --------------------------------- // --------------------------------- --------------------------------- // --------------------------------- V - file.php - V (bvbserver.com/MTA/file.php) <?php include("mta_sdk.php"); if ($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR']) { mta::doReturn(-1, "Remote access not allowed"); exit; } $input = mta::getInput(); if ( isset($input[0]) && isset($input[1]) && isset($input[2]) && isset($input[3]) ) { $to = $input[0]; $from = $input[1]; $subject = $input[2]; $message = $input[3]; $headers = "From: " . $input[1]; mail($to, $subject, $message, $headers); mta::doReturn(0, "Success"); } else { mta::doReturn(-1, "Invalid input"); } ?> V - mta_sdk.php - V (bvbserver.com/MTA/mta_sdk.php) <?php /** ************************************ * MTA PHP SDK ************************************ * * @copyright Copyright (C) 2010, Multi Theft Auto * @author JackC, eAi, Sebas * @link http://www.mtasa.com * @version 0.4 */ class mta { private $useCurl = false; private $sockTimeout = 6; // seconds public $http_username = ''; public $http_password = ''; public $host = ''; public $port = ''; private $resources = array(); public function __construct( $host, $port, $username = "", $pass = "" ) { $this->host = $host; $this->port = $port; $this->http_username = $username; $this->http_password = $pass; } public function getResource ( $resourceName ) { foreach ( $this->resources as $resource ) { if ( $resource->getName == $resourceName ) return $resource; } $res = new Resource ( $resourceName, $this ); $this->resources[] = $res; return $res; } public static function getInput() { $out = mta::convertToObjects( json_decode( file_get_contents('php://input'), true ) ); return (is_array($out)) ? $out : false; } public static function doReturn() { $val = array(); for ( $i = 0; $i < func_num_args(); $i++ ) { $val[$i] = func_get_arg($i); } $val = mta::convertFromObjects($val); $json_output = json_encode($val); echo $json_output; } public function callFunction( $resourceName, $function, $args ) { if ( $args != null ) { $args = mta::convertFromObjects($args); $json_output = json_encode($args); } else { $json_output = ""; } $path = "/" . $resourceName . "/call/" . $function; $result = $this->do_post_request( $this->host, $this->port, $path, $json_output ); echo $json_output; $out = mta::convertToObjects( json_decode( $result, true ) ); return (is_array($out)) ? $out : false; } public static function convertToObjects( $item ) { if ( is_array($item) ) { foreach ( $item as &$value ) { $value = mta::convertToObjects( $value ); } } else if ( is_string($item) ) { if ( substr( $item, 0, 3 ) == "^E^" ) { $item = new Element( substr( $item, 3 ) ); } elseif ( substr( $item, 0, 3 ) == "^R^" ) { $item = $this->getResource( substr( $item, 3 ) ); } } return $item; } public static function convertFromObjects( $item ) { if ( is_array($item) ) { foreach ( $item as &$value ) { $value = mta::convertFromObjects($value); } } elseif ( is_object($item) ) { if ( get_class($item) == "Element" || get_class($item) == "Resource" ) { $item = $item->toString(); } } return $item; } function do_post_request( $host, $port, $path, $json_data ) { if ( $this->useCurl ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "http://{$host}:{$port}{$path}" ); curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $json_data ); $result = curl_exec($ch); curl_close($ch); return $result; } else { if ( !$fp = @fsockopen( $host, $port, $errno, $errstr, $this->sockTimeout ) ) { throw new Exception( "Could not connect to {$host}:{$port}" ); } $out = "POST {$path} HTTP/1.0\r\n"; $out .= "Host: {$host}:{$port}\r\n"; if ( $this->http_username && $this->http_password ) { $out .= "Authorization: Basic " . base64_encode( "{$this->http_username}:{$this->http_password}" ) . "\r\n"; } $out .= "Content-Length: " . strlen($json_data) . "\r\n"; $out .= "Content-Type: application/x-www-form-urlencoded\r\n\r\n"; //$out .= "Connection: close\r\n\r\n"; $out .= $json_data . "\r\n\r\n"; if ( !fputs( $fp, $out ) ) { throw new Exception( "Unable to send request to {$host}:{$port}" ); } @stream_set_timeout( $fp, $this->sockTimeout ); $status = @socket_get_status($fp); $response = ''; while ( !feof($fp) && !$status['timed_out'] ) { $response .= fgets( $fp, 128 ); $status = socket_get_status($fp); } fclose( $fp ); $tmp = explode( "\r\n\r\n", $response, 2 ); $headers = $tmp[0]; $response = trim($tmp[1]); preg_match( "/HTTP\/1.(?:0|1)\s*([0-9]{3})/", $headers, $matches ); $statusCode = intval($matches[1]); if ( $statusCode != 200 ) { switch( $statusCode ) { case 401: throw new Exception( "Access Denied. This server requires authentication. Please ensure that a valid username and password combination is provided." ); break; case 404: throw new Exception( "There was a problem with the request. Ensure that the resource exists and that the name is spelled correctly." ); break; } } if ( preg_match( "/^error/i", $response ) ) { throw new Exception( ucwords( preg_replace("/^error:?\s*/i", "", $response ) ) ); } return $response; } } } class Element { var $id; function Element($id) { $this->id = $id; } function toString() { return "^E^" . $this->id; } } class Resource { var $name; private $server; function Resource($name, $server) { $this->name = $name; $this->server = $server; } function toString() { return "^R^" . $this->name; } public function getName() { return $this->name; } function call ( $function ) { $val = array(); for ( $i = 1; $i < func_num_args(); $i++ ) { $val[$i-1] = func_get_arg($i); } return $this->server->callFunction ( $this->name, $function, $val ); } } ?> HELP ME PLEASE, I NEED SEND A MESSAGE TO PLAYER MAIL
  6. my server is very delayed, can anyone tell me if it is a script? currently my server has 100/120 players
  7. function MotoristaDeUberAirNew () local Level = getElementData ( source, "Level" ) or 0 if Level => 10 then TudoInvisivel () setElementVisibleTo ( MotoristaDeUber, source, true ) setElementData ( source, "AirNew>Encaminhamento", "Motorista de Uber" ) outputChatBox ( "Emprego: Para Iniciar os Serviços siga o Checkpoint Vermelho em seu Minimapa", source ) triggerClientEvent ( source, "AirNew>FecharAgencia", root ) setElementData ( source, "Emprego", false ) else outputChatBox ( "Emprego: Você não possui Nivel suficiente para essa Profissão!", source ) end end addEvent( "Encaminhar>MotoristaDeUber", true ) addEventHandler( "Encaminhar>MotoristaDeUber", getRootElement(), MotoristaDeUberAirNew )
  8. Meu servidor não aparece na lista de servidores, eu já testei o site em https://nightly.multitheftauto.com/ports/ e lá está tudo bem, mas não aparece na lista de servidores, o que pode ser? SERVER IP: mtasa://172.106.11.148:22003
  9. My server does not appear in the list of servers, I have already tested the site at https://nightly.multitheftauto.com/ports/ and there everything is OK, but it does not appear in the server list, what can it be? SERVER IP: mtasa://172.106.11.148:22003
  10. Ai é que ta, em certos horarios o servidor fica com o ping normal, mais tem um certo delay como se o Ping estivesse no 500, por isso esse topico, pra ver oque posso melhorar na minha VPS
×
×
  • Create New...