MAACC Posted April 17, 2016 Share Posted April 17, 2016 Greetings , sorry for the inconvenience , please , if I can help with this little Script truth I got a little tangled, because not much about it , because I want to do is that with a single command to open and close said barrier , but and tried and what it does is go for anywhere but where it should , if you please can you help me I would appreciate it very much. function createTheGate () myGate1 = createObject ( 968, -96.900001525879,1208.5999755859, 19.5 , 0, 269.25, 1.9999389648438) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate1, 4500, -96.900001525879,1208.5999755859, 19.5, 0, 60, 0 ) end addCommandHandler("abrirbarrera",openMyGate) function movingMyGateBack () moveObject ( myGate1, 4500, -96.900001525879,1208.5999755859, 19.5, 0, -60, 0) end addCommandHandler("cerrarbarrera",movingMyGateBack) Link to comment
Seba500PLK Posted April 17, 2016 Share Posted April 17, 2016 function createTheGate () myGate1 = createObject ( 968, -96.900001525879,1208.5999755859, 19.5 , 0, 269.25, 1.9999389648438) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) local open = false function openMyGate ( ) if open then moveObject ( myGate1, 4500, -96.900001525879,1208.5999755859, 19.5, 0, -60, 0) open = false else moveObject ( myGate1, 4500, -96.900001525879,1208.5999755859, 19.5, 0, 60, 0 ) open = true end end addCommandHandler("barrera",openMyGate) Link to comment
MAACC Posted April 18, 2016 Author Share Posted April 18, 2016 Thank you, it has worked great! Link to comment
Seba500PLK Posted April 19, 2016 Share Posted April 19, 2016 Thank you, it has worked great! you welcome 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