FatalTerror

[TUT] PHP SDK

Do you like this tutorial ?  

106 members have voted

  1. 1. Do you like this tutorial ?

    • Yes
      93
    • No
      13


Recommended Posts

Nice tuto , it is very useful c:, but when I done the first example appear Hello Mr.Padawan this is right ? or I done something bad in this ?

Yea, you are right :)

With this example, you learn how transfer informations Site > Server.

You say to the server to get the name of your cat, the site get & return it to the server.

Share this post


Link to post

Could someone provide a mirror link for the SDK (0.4)?

I can't download it from the current link :roll:

Share this post


Link to post

I need your help about PHP_SDK plugin.

I know how to return strings through php, so I just ask:

How can I return an image to the MTA? doReturn - returns nil all the time

I tried converting image to a string , but dxCreateTexture don't treat that string as a pixels.

Maybe do you know how to convert it so MTA will understand the code?

Also tied sending an image to a server [ftp] but my php server do not allow ftp connections.

Any clues?

Share this post


Link to post

You only need to get the image file content and send it as a string ( simply read the file ).

Share this post


Link to post

I tried fread and file_get_contents and It seems that this is working, because when I am outputing the string version of an image I see a code in the browser, but when I am trying to send it to MTA, MTA outputs nil all the time.

<?php 
 include( "mta_sdk.php" ); 
 $input = mta::getInput(); 
 $player = $input[0]; 
 $url = $input[1]; 
  
  $str = file_get_contents($url); 
  
  mta::doReturn($player,$str); 
?> 

  
function imageURL(thePlayer,cmd,url) 
    callRemote ( "http://mywebsite.com/image.php", mail_return, thePlayer, url) 
end 
addCommandHandler("url",imageURL) 
  
function mail_return(player,str) 
    outputConsole(player) -- returns me as an element 
    outputConsole(str) -- returns always 'nil' 
end 
  

Share this post


Link to post

Seriously, did you realize this is a year and 2 months old thread? Obviously, it's outdated already.

Share this post


Link to post

Hm, someone can help me ?

What I should type here :

public $http_username = '';

public $http_password = '';

Also If you will record a video tutorial it will be great.

Share this post


Link to post

With HTTP username and password you can call functions in MTA server via PHP. That needs an account on MTA server which must have special privileges. It is all explained on wiki. You don't need to fill those variables, but if you want to call function on server, you can just put username and password as arguments of SDK call function.

Share this post


Link to post
With HTTP username and password you can call functions in MTA server via PHP. That needs an account on MTA server which must have special privileges. It is all explained on wiki. You don't need to fill those variables, but if you want to call function on server, you can just put username and password as arguments of SDK call function.

Thanks so much ! :)

Share this post


Link to post

Hello!

 

I made a website, what call a server function.

This function is insert the chat strings to an array.

The php get this array (json), with mta_sdk.

Quote

    $mtaServer = new mta($hostname, $port, $username, $password);
    $resource = $mtaServer->getResource("getChatJSONArray");

Everything is working fine, but the chat is calling this server function in every secound, (because this is a live chat, and need refresh).

Every time, when i call the server function, the php is connect to the server HTTP and the MTA server is ignoring my website.

Quote

[20:48:20] HTTP: Connection flood from 'xx.xxx.xxx.x'. Ignoring for 1 min.

How can i make this website, with one HTTP login?

Edited by gpetersz

Share this post


Link to post

hi. How I can start/stop/restart the server with PHPSDK? The server running in windows server. Thanx.

Edited by ztajti

Share this post


Link to post
On 20/11/2018 at 14:56, ztajti said:

hi. How I can start/stop/restart the server with PHPSDK? The server running in windows server. Thanx.

You can use Open Game Panel ,  And run your server on it, and use API....

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.