Lopez4Life Posted January 25, 2014 Share Posted January 25, 2014 So I just started coding basic LUA, I have no idea of how it actually works. I've got the needed object models, coordinates for a gate I'm trying to make. I want to make it so if I do the command /open the gate moves to certain position, and if I do /close it'll move to another certain position I have the coordinates for both /open and /close positions as I said. Thanks for the help guys. Hope to get some replies. Link to comment
Anubhav Posted January 25, 2014 Share Posted January 25, 2014 gate = createObject ( 2951, -1868.5, -3104.1999511719, 54.700000762939, 0, 0, 318) -- Gate. function Open ( pla ) -- the function if getElementType ( pla ) == "player" then -- if he is a player. if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then -- it is only for admins. moveObject (othergate1, 2500, -1868.5, -3104.1999511719, 56.900001525879) -- It will move the gate. end -- Closing functions and all... end end addEventHandler ( "onColShapeHit", col, Open) -- Adding a event handler. addCommandHandler ( "open",Open) -- Adding the command. function Close ( pla ) -- Function if getElementType ( pla ) == "player" then -- as i said for checking if its a player. if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then -- for admins only./ moveObject (othergate1, 2500,-1868.5, -3104.1999511719, 54.700000762939) -- close the gate. end end end addEventHandler ( "onColShapeLeave", col, Close ) addCommandHandler ("close", Close) gate = createObject ( 2951, y, x, z) to get the x,y,z go to freeroam and where you want to put do /getpos and replace it with it. Link to comment
Lopez4Life Posted January 25, 2014 Author Share Posted January 25, 2014 Thanks, now I wonder, how do I compile / convert that into a resource? Link to comment
Anubhav Posted January 25, 2014 Share Posted January 25, 2014 luac.multitheftauto.com Remember to keep a copy of it! Link to comment
Lopez4Life Posted January 25, 2014 Author Share Posted January 25, 2014 So I just modified that code to make it work the way I want it I compiled it, got the LUAC file, what next? gate = createObject ( 980, -805.59997558594, 2379.6000976563, 155, 0, 0, 318) -- Gate. function Open ( pla ) -- the function if getElementType ( pla ) == "player" then -- if he is a player. if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "legend" ) ) then -- it is only for admins. moveObject (gate, 2500, -805.59997558594, 2379.6000976563, 148) -- It will move the gate. end -- Closing functions and all... end end addEventHandler ( "onColShapeHit", col, Open) -- Adding a event handler. addCommandHandler ( "open",Open) -- Adding the command. function Close ( pla ) -- Function if getElementType ( pla ) == "player" then -- as i said for checking if its a player. if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "legend" ) ) then -- for admins only./ moveObject (gate, 2500,-805.59997558594, 2379.6000976563, 155) -- close the gate. end end end addEventHandler ( "onColShapeLeave", col, Close ) addCommandHandler ("close", Close) Link to comment
Lopez4Life Posted January 25, 2014 Author Share Posted January 25, 2014 I just need help on what to do next with the luac file Link to comment
Anubhav Posted January 25, 2014 Share Posted January 25, 2014 put the both in folder of it or make backup of lua and delete that. LUAC Is a encrypted version of LUA. Link to comment
Lopez4Life Posted January 25, 2014 Author Share Posted January 25, 2014 put the both in folder of it or make backup of lua and delete that. LUAC Is a encrypted version of LUA. What about the meta.xml file? Do I need to make one Link to comment
Anubhav Posted January 25, 2014 Share Posted January 25, 2014 Ofcouse. Meta is main thing of resource. Link to comment
Lopez4Life Posted January 25, 2014 Author Share Posted January 25, 2014 Ofcouse. Meta is main thing of resource. As I said, I lack of LUA knowledge, is there any way you could give me a hand? Skype or anything? Link to comment
Anubhav Posted January 25, 2014 Share Posted January 25, 2014 Lopez add me on skype anubhav.agarwal87 , i will help you in LUA. 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