daftagg Posted January 4, 2008 Share Posted January 4, 2008 (edited) Are there tutorials for totally beginners that just started scripting? look at this crappy 25+ errors script i made, i dont even know what im doing myself i probably only understanded 2% of the introduction of scripting -- crappy 25 error+ rpg script players = getElementsByType ( "player" ) root = getRootElement () function spawnPlayer (thePlayer) local playerSpawnPoint = WHAT SHOULD I PUT HERE fadeCamera ( source, true ) givePlayerMoney ( player thePlayer, 10000 amount ) end function onPlayerKill (thePlayer) playersname= getClientName(source) outputChatBox("zomfgz bitchass you just killed someone you stupid f***face dmer/cheater your going to be banned!(or you get spawned 10 minutes later)", source) KillPlayer(source) setTimer(spawnPlayer, 600000, 1, source) end addEventHandler("onPlayerKill", root, onPlayerKill) function onPlayerJoin () playerName = getClientName(source) outputChatBox("welcome, " .. playerName .. ", you have been given 10000 for joining this server, and DON'T DM because its a RPG server, thank you.", source) spawnPlayer(source) end addEventHandler("onPlayerJoin", root, onPlayerJoin) function onPlayerDeath () outputChatBox("You died! Please wait 10 seconds to respawn", source) setTimer(spawnPlayer, 10000, 1, source) end addEventHandler("onPlayerWasted", root, onPlayerDeath) what does root mean? what does (source) mean? Edited January 5, 2008 by Guest Link to comment
BrokenGlass Posted January 4, 2008 Share Posted January 4, 2008 Might not want to start trying to make an RP script if you dont know lua... Link to comment
daftagg Posted January 5, 2008 Author Share Posted January 5, 2008 thats why i want a tutorial and btw, how many errors are there? Link to comment
ChrML Posted January 5, 2008 Share Posted January 5, 2008 Root is the element that is the parent of all the elements on the server. If you do something with the root, it'll get done to all the players/vehicles/obects etc.. on the server. Source inside event handlers is the element that an event was triggered on. For example in onPlayerJoin, onPlayerQuit and other onPlayer* events the source is the player. Link to comment
daftagg Posted January 5, 2008 Author Share Posted January 5, 2008 Is this script totally meaningless? Link to comment
Guest Posted January 6, 2008 Share Posted January 6, 2008 Hey Frank, I need the same thing, a tutorial or at least a hint where to start learning...... I only know VB.net and it seems to completely different to this! Link to comment
ShOtGuN Posted January 6, 2008 Share Posted January 6, 2008 Take a look at this: http://development.mtasa.com/index.php? ... troduction You should really start to read the mta wiki Link to comment
daftagg Posted January 6, 2008 Author Share Posted January 6, 2008 Take a look at this: http://development.mtasa.com/index.php? ... troductionYou should really start to read the mta wiki Did you just read this, and you understand it? because thats pretty creepy. Link to comment
xGj Posted January 6, 2008 Share Posted January 6, 2008 That's not creepy it's fairly easy... If you read it properly, don't just copy and paste it but try to write it yourself again without looking at the wiki, and trying to understand what's written there about all different functions, you'll get to know it pretty fast. Then again, if you can't understand that, coding/scripting might not be the thing for you.. take a look at this LUA Manual too tho: http://www.lua.org/manual/5.0/ Link to comment
driver2 Posted January 7, 2008 Share Posted January 7, 2008 The Scripting Introduction introduces into Lua Scripting for MTA, not Lua Scrpting in general. You still need to know how to code first. Link to comment
Hoss212 Posted January 7, 2008 Share Posted January 7, 2008 I believe this is what the MTA wiki is supposed to be for? I'm sure the team will create tutorials for beginners, and if not there is always experts scattered around to help. Link to comment
Azu Posted January 7, 2008 Share Posted January 7, 2008 Coding/Scripting can be for everyone. It just depends on the will of the person. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now