Mta Script Editor Download
Getting started with MTA:Lua Welcome to my first of series tutorials of MTA Lua scripting. I will do my best to explain this in a more noob-friendly way than MTA Wiki does. I hope some of our community scripters will help me out a bit and suggest what to improve to make this easy to understand. So let’s get started. I will be following some Wiki way of learning, so we are starting with “Locating your Resources folder” 1) Locating your “Resources” folder This folder contains all the resources your server will run, including maps, scripts, gamemodes et cetera. Locating: 1) Find your Multi Theft Auto directory (By default (for Windows users) it’s in Program Files, Disk C) 2) Open MTA Directory, then folder “server” > “mods” > “deatchmatch” > “resources” There we go, you’re now here: MTA San Andreas 1.3 server mods deathmatch resources Now when you have located where your resources folder is, you may see bunch of.rar files and folders.
These are all scripts and gamemodes provided by MTA and everyone should have them as they come by default with your MTA installation. 2) My first resource There are two things your resource HAS to contain: 1) meta.xml – Meta is basicly telling the server what your resource contains and how should the files within be used, your resource cannot work without a working meta!! 2) file.lua – the.lua file is your script which should be defined in your meta.xml (detailed explanation further in tutorial) Meta.xml should look like this: author – self explanatory, the author of this resource, you may put your name here type – type of your resource, we will use “script” name – name your script description – optional, explain what your script does in couple of words and the most important part: src – the name must correspond to your script name, if it is named myscript.lua then we will rename it from file.lua to myscript.lua Why? Because meta needs correct info so it could load your script for server type – client or server – by default (if not defined) the type of script will be server I think that should be clear now. LET’S CREATE YOUR FIRST SCRIPT! Useful tools: (Highly recommended, highlights your functions and make scripting A LOT easier) or All MTA functions are located here: Before we start.
Here is the great list of useful Parameter IDs. Parameter IDs allows users to set up defaults for most SAP fields that have a dropdown selection.
MTA uses two type of functions – clientside and serverside. Difference you mean? Clientside functions and Serversided CANNOT work in a same script.
Clientsided files (scripts) are downloaded to your computer when joining a server while serversided files don’t. We will be making a serversided script therefore we are going to use server functions (Note: Many MTA functions can be used in clientside and serverside, but some are only working in serverside/clientside scripts!). If this part isn’t clear enough, post below. Let’s start this already, shall we. Function outputName () outputChatBox (“Welcome to the server ”.
GetPlayerName (source ), source, 255, 0, 0 ) end addEventHandler (“onPlayerJoin”, getRootElement (), outputName ) Let’s break this code into pieces and explain part by part. Function outputName () “function” indicates start of our code, let’s say it that way “outputName” – this is the name of our function, it can be anything you wish, but let’s keep the name of function related to our code “()” – brackets are used for some additional arguments which we will need for our code, in this case we leave those empty because we don’t need any other arguments in there outputChatBox is both, client and server side function, which means you can use it in both type of scripts. It’s name is self-explanatory, it outputs a string (text) in our chatbox.