Aveee Posted February 25, 2014 Share Posted February 25, 2014 Hello I've decided to learn the Lua language, but I don't know where shall I start. Can you guys tell me where do I start and what should I learn? I don't know any other scripting or programming languages, I'm beginner at it, I just want to start right now with it. Link to comment
Vision Posted February 25, 2014 Share Posted February 25, 2014 viewtopic.php?f=148&t=40809 Link to comment
Deepu Posted February 26, 2014 Share Posted February 26, 2014 Friend, I think you gotta start off with the LUA basics as Wiki doesnt have all of lua..... Just google lua tutorial and then go to the first topic after learning the blocks or chunks or functions and all then you gotta go to the mta wiki Soon after that you gotta start making some simple scripts like outputChatBox and others Link to comment
glowdemon1 Posted February 26, 2014 Share Posted February 26, 2014 I just youtubed some videos to get started, after that I started using the wiki and the IRC which helped me ALOT. Link to comment
Atton Posted February 26, 2014 Share Posted February 26, 2014 Play with run code and try things like outputChatBox. For exmaple srun outputChatBox("Tuna") Link to comment
Thorxx Posted February 28, 2014 Share Posted February 28, 2014 The most easy way is looking to code in free scripts, it helped me a lot. And also trying some things with outputChatBox as Atton said above me. Then you can try some mathematical things, they are also easy. Link to comment
Insid Posted February 28, 2014 Share Posted February 28, 2014 I definitely agree with looking at free resources' code and looking up the functions on the wiki. I had written my first Lua script within hours of setting up my server. Y'all can check it out here and tell me how noobish it is: https://community.multitheftauto.com/index.php?p= ... ls&id=8808 Link to comment
Thorxx Posted March 1, 2014 Share Posted March 1, 2014 I definitely agree with looking at free resources' code and looking up the functions on the wiki. I had written my first Lua script within hours of setting up my server. Y'all can check it out here and tell me how noobish it is: https://community.multitheftauto.com/index.php?p= ... ls&id=8808 That's a good job for your first script! There are two from my beginnings: Random Clan Colors: function teams () team = createTeam("YourTeam") setTimer(randomCOLOR, 5000, 0) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), teams) function movePlayer () if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin")) then setPlayerTeam(source, team) end end addEventHandler("onPlayerLogin", root, movePlayer) function randomCOLOR () local R3 = math.random( 0, 255 ) local G3 = math.random( 0, 255 ) local B3 = math.random( 0, 255 ) setTeamColor(team, R3, G3, B3) end Date & Time: function real () local days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"} local time = getRealTime() local timeINFO = string.format("%02d:%02d:%02d", time.hour, time.minute, time.second) local dateINFO = string.format("%02d/%02d/%04d", time.monthday, time.month+1, time.year+1900) local wd = time.weekday+1 outputChatBox("#ff8f00------------------------------------------------------------------", 255,255,255,true) outputChatBox("#ffffffTime: "..timeINFO, 255,255,255,true) outputChatBox("#ffffffDate: "..dateINFO, 255,255,255,true) outputChatBox("#ffffffDay: "..days[wd], 255,255,255,true) outputChatBox("#ff8f00------------------------------------------------------------------", 255,255,255,true) end addCommandHandler("date", real ) Link to comment
xeon17 Posted March 1, 2014 Share Posted March 1, 2014 My frist script was a Deagle Event function mensagemEvento ( ) outputChatBox ( "#00FFFF [sERVER] To Enter the Event write /participar in chat", getRootElement(), 255, 0, 0, true ) end addEventHandler ( "onResourceStart", getResourceRootElement ( ), mensagemEvento ) function funcoesEvento ( thePlayer ) takeAllWeapons ( thePlayer ) setElementDimension ( thePlayer, 300 ) setPedArmor ( thePlayer, 100 ) setElementHealth ( thePlayer, 569 ) giveWeapon ( thePlayer, 24, 1000000000 ) setElementPosition ( thePlayer, -260.60818481445, 2336.3356933594, 108.55751037598 ) outputChatBox("[EVENTO] You got a Deagle !.",thePlayer,0,255,255) outputChatBox("[EVENTO] You got health & armor.",thePlayer,0,255,255) addEventHandler ( "onPlayerSpawn", thePlayer, onSpawn ) end addCommandHandler ( "participar", funcoesEvento ) function parandoEvento ( ) outputChatBox ( "#00FFFFEvent Closed", getRootElement(), 255, 0, 0, true ) end addEventHandler ( "onResourceStop", getResourceRootElement ( ), parandoEvento ) function onSpawn ( ) takeAllWeapons ( source ) setElementDimension ( source, 300 ) setPedArmor ( source, 100 ) setElementHealth ( source, 569 ) giveWeapon ( source, 24, 1000000000 ) setElementPosition ( source, -260.60818481445, 2336.3356933594, 108.55751037598 ) end Link to comment
Thorxx Posted March 1, 2014 Share Posted March 1, 2014 Isn't the maximal dimension 255? Link to comment
WhoAmI Posted March 1, 2014 Share Posted March 1, 2014 Mximal dimension is about 65k. Link to comment
xeon17 Posted March 1, 2014 Share Posted March 1, 2014 65535 is the Maxium More then enough Link to comment
myonlake Posted March 1, 2014 Share Posted March 1, 2014 Isn't the maximal dimension 255? No, the interior count is 255, you mixed those two 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