Jump to content

Search the Community

Showing results for tags 'sdk'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 5 results

  1. Hey! Would someone tell me how to do getPlayerPing for the php sdk library? I only managed to make a list of players on the server function listPlayer( ) local players = {} for k, player in ipairs( getElementsByType ("player") ) do local player = getPlayerName( player ) table.insert( players, player ) end return players end
  2. Hello guys. I'm trying to use the PHP SDK from MTA: SA on my site but I can not. What I want to do is get the basic information from a server as a number of players online, whether it is password protected, or no password, whether online or offline. I just can not find any documentation to help me. Can someone help me?
  3. Swagy

    [HELP] PHP SDK

    <?php require "mta_sdk.php"; $mtaServer = new mta( '137.74.164.56', 22006); $resource = $mtaServer->getResource ( 'UDCupdates', $mtaServer ); $returns[] = $resource->call('addUpdate', $_POST['name'], $_POST['dev']); ?> ok I use this in the PHP file, don't mind the HTML file since it works fine, now I'll show you my MTA script local sql = executeSQLQuery function createTables () sql("CREATE TABLE IF NOT EXISTS updates (update TEXT, developer TEXT, date TIMESTAMP DEFAULT CURRENT_TIMESTAMP)") end addEventHandler("onClientGUIClick", root, createTables) function addUpdate (text, dev) if (text) then if (dev) then sql("INSERT INTO updates (update, developer) VALUES (?,?)", text, dev) outputChatBox("[Updates] "..text.." ("..dev..")",root,255,130,4) return true else return false end else return false end end resource is started and export is added, but the problem is call function in PHP, help please.
  4. Hi, today i was trying to do function which displays players who are online on my website using php_sdk and i have problem with connection to server. HTTP port is opened, user who i'm using to connect has admin rights and it's not working. mta_sdk version 0.4 - downloaded from wiki mta this is php file on my website: <?php include( "mta_sdk.php" ); $mtaServer = new mta( "ip", 20145, "mta_php_sdk", "password" ); $resource = $mtaServer->getResource ( "php" ); $returns[] = $resource->call ( "getPlayersOnline" ); ?> And the error: Fatal error: Uncaught exception 'Exception' with message 'Could not connect to ip:20145' in /home/users/XXX/public_html/YYY/mta_php_sdk/mta_sdk.php:146 Stack trace: #0 /home/users/XXX/public_html/YYY/mta_php_sdk/mta_sdk.php(79): mta->do_post_request('ip', 20145, '/php/call...', '') #1 /home/users/XXX/public_html/YYY/mta_php_sdk/mta_sdk.php(257): mta->callFunction('php', 'getPlayersOnlin...', Array) #2 /home/users/XXX/public_html/YYY/mta_php_sdk/mta.php(38): Resource->call('getPlayersOnlin...') #3 {main} thrown in /home/users/XXX/public_html/YYY/mta_php_sdk/mta_sdk.php on line 146 If i visit in my browser ip:20145/php/call/getPlayersOnline everything is working correctly. How can i fix it?
  5. Hello everyone this is my first post please take it easy on me. here goes nothing. I followed xxmadexx's tutorial https://forum.multitheftauto.com/topic/74834-introduction-to-the-php-sdk/ It works and my site show the users. but I was wondering how do I go about exporting more information such as score and other information stored on the server. This is my server.lua file function getAllPlayersForWebsite ( ) local players = {} for k, player in ipairs( getElementsByType ("player") ) do local name = getPlayerName( player ) table.insert( players, name ) end return players end my meta xml <meta> <info author="xXMADEXx" type="script" version="1.0" name="MTA PHP" /> <!-- Include our awesome script --> <script src="server.lua" /> <!-- Export our function -- Make sure to allow HTTP to access it --> <export function="doPrint" type="server" http="true" /> <export function="getAllPlayersForWebsite" type="server" http="true" /> </meta> and the php file <?php include "sdk/mta_sdk.php"; # Include the MTA PHP SDK - Give us the classes and methods that we'll need $MY_SERVER = [ "host" => "54.153.65.51", #The host/IP of your MTA server "http_port" => 22005, #The HTTP port for your MTA server (Default 22005) "http_user" => "user", #The username that we created in the previous step "http_pass" => "password" #The password for the username that we created ]; #Create a new mta object $SERVER = new mta ( $MY_SERVER['host'], $MY_SERVER['http_port'], $MY_SERVER['http_user'], $MY_SERVER['http_pass'] ); try { $RESOURCE = $SERVER->getResource ( "mta_php" ); # We need to get our resource Object $RESULT[] = $RESOURCE->call ( "getAllPlayersForWebsite" ); foreach ( $RESULT [ 0 ] [ 0 ] as $index=>$playerName ) { print_r ( $playerName ); echo "<br /><br />"; } #Catch any errors that occurred } catch ( Exception $e ){ #Output error message echo "<strong>Oops, Something went wrong!</strong><br />Error: {$e->getMessage()}<br /><br />e printout:<br />"; #Print the error table print_r ( $e ); } ?> Where should I start?
×
×
  • Create New...