Jump to content

FatalTerror

Members
  • Posts

    304
  • Joined

  • Last visited

Everything posted by FatalTerror

  1. You add an "else" and set a Peace Flag
  2. FatalTerror killed CapY (Justin Bieber song)
  3. Oi, Voce vai ter que mecher un pouco com o Map Editor e LUA. As principais function que vc vai ter que usar sao: createRadarArea getRadarAreaColor getRadarAreaSize isInsideRadarArea isRadarAreaFlashing setRadarAreaColor setRadarAreaFlashing setRadarAreaSize getTeamColor getTeamFriendlyFire getTeamFromName getTeamName getPlayersInTeam createTeam e muitas outras... Voce vai ter que aprender o LUA ou esperar que alguen fassa o script. Edit: PARA DE USAR O CAPS E UMA MERDA !
  4. Surement parce qu'il a été copié...
  5. Hi It's simple... When you set the data in the scoreboard, the column name must be "countryCode" per example. And it must be a number (0-9). When the player press in tab, the scoreboard go search in his files the pic "flags/(0-9).png". Example ? exports.scoreboard:addScoreboardColumn("countryCode", getRootElement(), 1, 0.2) -- Arguments: 1th is the column name, 2nd is getRootElement(), 3rd is the value, 4th is the size Good luck, FatalTerror Edit: the img must be in scoreboard resource
  6. Hi Try that: addEventHandler("onPlayerLogin", getRootElement(), function() local account = getPlayerAccount(source) if not isGuestAccount(account) then local x = getAccountData(account, "player-x") local y = getAccountData(account, "player-y") local z = getAccountData(account, "player-z") if x and y and z then spawnPlayer(source, x, y, z) outputChatBox("Welcome to our server !", source, 255, 255, 255, true) end end end) addEventHandler("onPlayerQuit", getRootElement(), function() local account = getPlayerAccount(source) if not isGuestAccount(account) then local x, y, z = getElementPosition(source) if x and y and z then setAccountData(account, "player-x", x) setAccountData(account, "player-y", y) setAccountData(account, "player-z", z) end end end)
  7. If you want, i can help you Bye, FatalTerror
  8. Hi, I've playing in a server and i see a thing, a text before the download. Exist an event for it? How he do it Thanks
  9. Castillo comes and fucck everybody Great
  10. addCommandHandler("godoff", function() if (getElementData(source, "admin") == true) then setElementData(source, "admin", false) end end)
  11. It's not very hard, you have just to stock the stats of player in database MySQL Example: local deads = getElementData(player, "deads") local wins = getElementData(player, "wins") local player = getPlayerName(player) callRemote("http://www.yourwebsite.com/MTA/test.php", result, deads, wins, player) And you get these informations in PHP file $table = mta::getInput(); $deads= $table[0]; $wins = $table[1]; $player = $table[2]; // Send infos in MySQL $base = mysql_connect ('host', 'login', 'password'); mysql_select_db ('database', $base); $sql = 'INSERT INTO player_stats VALUES("$player", "'.$deads.'", "'.$wins.'") '; mysql_query($sql); mysql_close(); // Return true if is added mta::doReturn(true); Now, in another file, you can get the informations only using PHP & MySQL Example, you have a file with stats of every players have played in your server <?php $base = mysql_connect ('host', 'login', 'password'); mysql_select_db ('database', $base); $sql = 'SELECT * FROM player_stats'; $req = mysql_query($sql); while($data = mysql_fetch_array($req)){ $playername = $data['name']; $deads = $data['deads']; $wins = $data['wins']; echo "<b>$playername</b><br /> Wins: $wins<br /> Deads: $deads<br />"; } mysql_close(); ?>
  12. does it work good if you rejoin to the server? lol Yea, i don't test x)
  13. Hi, I don't know if someone have allready made this script. But i think you can made it youself Example, when the player are domaged, we check if is an admin and if it's an admin, we cancel the event. So he are not domaged I think it work... addEventHandler ( "onPlayerDamage", getRootElement (), function(attacker, weapon, bodypart, loss) local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then cancelEvent() end end
  14. Where is the element? source ? If you are in client side you can try function expcalculate () setElementData(getLocalPlayer(), "EXP",tonumber(getElementData(getLocalPlayer(), "EXP"))+1) end setTimer(expcalculate, 20000,0) And if you are in server side... You must have an player addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for i, player in ipairs(getElementsByType ( "player" )) do setTimer(expcalculate, 20000, 0, player) end end) function expcalculate(player) setElementData(player, "EXP",tonumber(getElementData(player, "EXP"))+1) end
  15. I think to make a delete map with this function and.. i can say to you. This don't delet resource... Hm this function delet the resource temporary and when you /refresh all. This fuuc.. resource u have deleted come back @MTAdeveloppers: WHAT IS THIS WORK ?! Are u kidding with us? For the min_version, it work perfect in 1.2 Bye
  16. The login panel have admin rights?
  17. [Tutorial] PHP SDK Hi everybody! Today, it's the new year and i will make a tutorial for this community... It's my gift This tutorial is to teach to you how use the PHP SDK and what we can do with it. The tutorial is offered by MTAScripts.net. Enjoy Summary What is the PHP SDK What we can do with it How to install How to use (SERVER) How to use (WEB) Download a demo What is the PHP SDK To begin, PHP is a dynamic programming language web. Why we say dynamic ? Because we can interact with the user and the webserver. The PHP is the principal dynamic language used in the web with the HTML. We can call this language "SUPER PHP" because he can make everything... Examples: Facebook.com MTASA.com Twitter.com Every forums... And more Okey, we know what is the PHP, now the SDK ? SDK mean Software Development Kit, it's a library allow to developpers to make his applications. Multiple plateforms propose his SDK. Just search on Google Examples: Facebook SDK Have so much... Search on Google (Google have too his SDK) For continue this tutorial, you must download the PHP SDK from MTA. Download What we can do with it The PHP SDK from MTA offer much possibility. You can do everything with it if you have a great imagination Examples ? Login the player When the user join the server and he must login, if he have allready a login in the forum. We login the player with it And if he don't have, we create a new account in the server AND in the forum Stats of the player If the player play in the server and if he have an account in the server and the forum. We can show the stats of the player in the forum. Facebook This is more hard but ITS POSSIBLE ! If the player is logged in Facebook, the server send a request in the web and the web send a request to Facebook. If Facebook confirm, Facebook send informations to the webserver and the server will return this. So if you have an login panel, you can make a button "Login with Facebook". I don't will write my ideas, find yours So you can see, if you have great ideas... You can make some big things How to install We attack ! First, you must: A website A FTP account of the website Client FTP (Filezilla, ...) The library PHP SDK For this tutorial, i will use a fake website. Now we can start You must create a folder in the root of your website. We will can him "MTA" Result: http://www.yourwebsite.com/MTA Now, we will create a new folder in the folder MTA We call him "sdk". Result: http://www.yourwebsite.com/MTA/sdk Now your extract the mtaphpsdk_0.4.zip file into sdk folder. You will have much files in this folder. The principal file is mta_sdk.php. Now you can access to the sdk via the web. Result: http://www.yourwebsite.com/MTA/sdk/mta_sdk.php If you don't have this result, try again Now, you create a new PHP File. Every PHP files have the extention ".php" or ".php3" (for the new version) You go to the MTA folder (http://www.yourwebsite.com/MTA) and you create a PHP file with the name "test" Result: http://www.yourwebsite.com/MTA/test.php You open this file with your text editor (Notepad++, Eclypse, Sublime Text, ...) We will include the library to the file. Before we start to include, you will start the php file. For do it you write the balise PHP Start: <?php Close: ?> <?php -- Your code here ?> We have start the PHP file, now we want include "mta_sdk.php" to our file "test.php". For do it, you must use the function include() For informations, every functions on PHP must finish with ";" Now we include the file using include() <?php require "sdk/mta_sdk.php"; ?> The library is successfully inclued, now our library are installed If you want be sure, you can access to this file (http://www.yourwebsite.com/MTA/test.php) If you have an error, try again How to use (Server) Ah The LUA part For start, you must create an resource in your server (local or not) We will call him... "test". You know how create an resource, if you don't know.. You are in the S.H.I.T In your resource, you will have 3 files Meta.xml Client.lua Server.lua <meta> <info name="My Test Script" author="FatalTerror" description="My first resource with PHP SDK" version="1.0.0" type="script"></info> <script src="client.lua" type="client"></script> <script src="server.lua" type="server"></script> </meta> Your client and server files are empy for a moment. Before we start ! You must give admin right to the resource, we will use a function require admin rights. You can do it with the Admin Panel or in the ACL.xml More infos: Wiki Page To start, you open the server.lua with your text editor and you write it. addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() end) function result() end Very simple code, 1 event when the resource start and a function "result". For call an file in the web, we use the function callRemote(). So, we will use this function with basic parameters. bool callRemote ( string URL, callback callbackFunction, [ arguments... ] ) Explain: The url is the PHP file you want call. The callback function is the function will call the website when the website return parameters. The arguments are the infos you will send to the website. Write it into the event handler. addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() callRemote ("http://www.yourwebsite.com/MTA/test.php", result, "Hello") end) This will send the argument "Hello" to the test.php file. We will see in the next step how get this argument in PHP file. Imagine... We send 1 argument to the web and we want get 1 other argument (the name of ... my cat, YES My cat rockz ! ) The PHP file will return this argument and we will get it via the result function. Remember? This function alone... (Poor function...) function result(value) if value ~= "ERROR" then end end end If have an value, we continue Now we have the cat's name, we show it with a simple outputChatBox() function result(value) if value ~= "ERROR" then outputChatBox("Hello Mr."..value, getRootElement()) end end Great, we have finish this part. You can see, ITS SIMPLE OF SIMPLE How to use (Web) The web part start ! Get ready...Prepare your keyboard . GO ! To start, open your test.php file with your text editor. And normally, we had already written the code in the file. After the include (remember?) we will get the argument sended via the server. How ? Using the mta::getInput() ! This function get arguments in an array. $table = mta::getInput(); Yeah ! We have our table with informations You are alive ? Okey ! $table = mta::getInput(); $text = $table[0]; Hm.. We get the argument of the table using this method and we set the argument into $text. Small check if have an value... $table = mta::getInput(); $text = $table[0]; if(isset($text)){ } Great.. We give a name of the cat ? Let me search.. Padawan ? $table = mta::getInput(); $text = $table[0]; if(isset($text)){ $cat = "Padawan"; } Now we return $cat to the server using the function mta::doReturn() $table = mta::getInput(); $text = $table[0]; if(isset($text)){ $cat = "Padawan"; mta::doReturn($cat); } Perfect ! Now when you start the script, he will send 1 info to the website and the website will return a thing... and this thing is the name of my cat And when the server have the name of the cat, he say hello to him Try it Schema Example 1: Use PHP/MYSQL In this example, we will see what we can do with the PHP & the database MySQL. Here, isn't the MySQL of the server but of the website. Require things: MySQL database Read the tuto OK, let's start. In this tutorial, we will make list of who is online in your server and store it on database. And for finish, show it. First thing we will do, create a table in the MYSQL Database. For that, we will store 3 things. ID Player name Serial Why the serial ? I don't know but it's usefull to store it SQL Code: CREATE TABLE `DATABASE_NAME`.`players` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `player` TEXT NOT NULL , `serial` TEXT NOT NULL ) ENGINE = MYISAM ; Remplace DATABASE_NAME per the database name... I don't explain this code cuz it's to much simple. I think you will learn it fast. Create a new resource on your server. We call him "web". In this resource, we have 2 files. Meta.xml Server.lua On server.lua, we will put an event, when the map change (It's more usefull for race servers). A council ! Never put an callRemote() when the player join ! Why ? It makes lag. If you have a big dedicated server, you can do it. addEventHandler("onGamemodeMapStart", getRootElement(), function(theMap) end) Well, it's okey for this step. Now we will create a new function to get an table with the player name without his hexcode. addEventHandler("onGamemodeMapStart", getRootElement(), function(theMap) end) function getPlayersName() local playerslist = {} for i,p in ipairs (getElementsByType("player")) do local thep = string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "") table.insert(playerslist,tostring(thep)) end return playerslist end Not very hard for the moment. We create an callRemote in the event. Like this: addEventHandler("onGamemodeMapStart", getRootElement(), function(theMap) local playerList = getPlayersName() if playerList then callRemote("http://wwww.website.com/MTA/players.php", returnFunction, playerList) end end) function returnFunction(value) if value ~= "ERROR" then end end function getPlayersName() local playerslist = {} for i,p in ipairs (getElementsByType("player")) do local thep = string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "") table.insert(playerslist,tostring(thep)) end return playerslist end Put a small message to check if the player list is successfully save with outputDebugString(). Damn, let's start with the PHP. Create a new document PHP in your website like that: http://www.website.com/MTA/players.php In this document, you include the PHP SDK AND the MySQL Connexion ! What is that? You must put 2 lines of code to connect the page to the MySQL database. The line are: $base = mysql_connect ('127.0.0.1', 'USERNAME', 'PASSWORD'); mysql_select_db ('DATABASE_NAME', $base); You check if you have any errors, just access to your page. TO BE CONTINUED... (I go to school ) It's the end of this tutorial, i hope it will be useful Good luck and have fun © MTAScripts.net, All rights reserved
  18. I think the moveObject move only objects... launch1 are marker element but moveObject() accept only objects element... bool moveObject ( object theObject, int time, float targetx, float targety, float targetz, [ float moverx, float movery, float moverz, string strEasingType, float fEasingPeriod, float fEasingAmplitude, float fEasingOvershoot ] )
×
×
  • Create New...