Wes Posted March 9, 2013 Share Posted March 9, 2013 Hey! Yeah it's me again. I've made a script which opens the gate. But it doesn't close itself. Can somebody help me how could I make it so after like 5-6 seconds it close the gate itself? The gate should be here when closed: moveObject(object1, 3000, 2497.1000976563, 2785.1000976563, 11.5, 0, 0, 0 ) -- closing the gates moveObject(object2, 3000, 2497.5, 2761.099609375, 11.5, 0, 0, 0) -- closing the gates and here is the whole code: object1 = createObject(986, 2497.3999023438, 2777.3000488281, 11.5, 0, 0, 270.24169921875) -- right gate object2 = createObject(985, 2497.3000488281, 2769.3000488281, 11.5, 0, 0, 270.24169921875) -- left gate function gateo(player) -- moving the gates function moveObject(object1, 3000, 2497.099609375, 2785.099609375, 11.5, 0, 0, 0) -- opening the gates moveObject(object2, 3000, 2497.3999023438, 2761, 11.5, 0, 0, 0) -- opening the gates end function gatec(player) -- closing the gates function moveObject(object1, 3000, 2497.1000976563, 2785.1000976563, 11.5, 0, 0, 0 ) -- closing the gates moveObject(object2, 3000, 2497.5, 2761.099609375, 11.5, 0, 0, 0) -- closing the gates end addCommandHandler("nopedotavi", gateo) Link to comment
Jaysds1 Posted March 9, 2013 Share Posted March 9, 2013 (edited) next time please use [xml]<div class="lua" id="{CB}" style="font-family: monospace;"><ol><li style="" class="li1"><div class=<span style="color: #ff0000;">"lua"</span> id=<span style="color: #ff0000;">"{CB}"</span> style=<span style="color: #ff0000;">"font-family: monospace;"</span>><ol><li style=<span style="color: #ff0000;">""</span> class=<span style="color: #ff0000;">"li1"</span>> </li></ol></div></li></ol></div>[/xml] tags please. try this: object1 = createObject(986, 2497.3999023438, 2777.3000488281, 11.5, 0, 0, 270.24169921875) -- right gate object2 = createObject(985, 2497.3000488281, 2769.3000488281, 11.5, 0, 0, 270.24169921875) -- left gate function gateo(player) -- moving the gates function moveObject(object1, 3000, 2497.099609375, 2785.099609375, 11.5, 0, 0, 0) -- opening the gates moveObject(object2, 3000, 2497.3999023438, 2761, 11.5, 0, 0, 0) -- opening the gates setTimer(gatec,5000,1) --set timer to close gates after 5 secs end function gatec(player) -- closing the gates function moveObject(object1, 3000, 2497.3999023438, 2777.3000488281, 11.5, 0, 0, 0 ) -- closing the gates moveObject(object2, 3000, 2497.3000488281, 2769.3000488281, 11.5, 0, 0, 0) -- closing the gates end addCommandHandler("nopedotavi", gateo) Edited March 9, 2013 by Guest Link to comment
Sasu Posted March 9, 2013 Share Posted March 9, 2013 object1 = createObject(986, 2497.3999023438, 2777.3000488281, 11.5, 0, 0, 270.24169921875) -- right gate object2 = createObject(985, 2497.3000488281, 2769.3000488281, 11.5, 0, 0, 270.24169921875) -- left gate function gateo() -- moving the gates function moveObject(object1, 3000, 2497.099609375, 2785.099609375, 11.5, 0, 0, 0) -- opening the gates moveObject(object2, 3000, 2497.3999023438, 2761, 11.5, 0, 0, 0) -- opening the gates end function gatec() -- closing the gates function moveObject(object1, 3000, 2497.3999023438, 2777.3000488281, 11.5, 0, 0, 0 ) -- closing the gates moveObject(object2, 3000, 2497.3000488281, 2769.3000488281, 11.5, 0, 0, 0) -- closing the gates end addCommandHandler("nopedotavi", gateo) addCommandHandler("nopedotavi2", gatec) You forgot create another commando to close. I create a command /nopedotavi2 to close. Link to comment
Jaysds1 Posted March 9, 2013 Share Posted March 9, 2013 You forgot create another commando to close. I create a command /nopedotavi2 to close. He said: how could I make it so after like 5-6 seconds it close the gate itself? Link to comment
Sasu Posted March 9, 2013 Share Posted March 9, 2013 You forgot create another commando to close. I create a command /nopedotavi2 to close. He said: how could I make it so after like 5-6 seconds it close the gate itself? Oh sorry. I didnt see that. Thanks for say me . And... Player argument Its not necesarry Link to comment
Wes Posted March 9, 2013 Author Share Posted March 9, 2013 next time please use [xml]<div class="lua" id="{CB}" style="font-family: monospace;"><ol><li style="" class="li1"><div class=<span style="color: #ff0000;">"lua"</span> id=<span style="color: #ff0000;">"{CB}"</span> style=<span style="color: #ff0000;">"font-family: monospace;"</span>><ol><li style=<span style="color: #ff0000;">""</span> class=<span style="color: #ff0000;">"li1"</span>><div class=<span style=<span style="color: #ff0000;">"color: #ff0000;"</span>><span style="color: #ff0000;">"lua"</span></span> id=<span style=<span style="color: #ff0000;">"color: #ff0000;"</span>><span style="color: #ff0000;">"{CB}"</span></span> style=<span style=<span style="color: #ff0000;">"color: #ff0000;"</span>><span style="color: #ff0000;">"font-family: monospace;"</span></span>><ol><li style=<span style=<span style="color: #ff0000;">"color: #ff0000;"</span>><span style="color: #ff0000;">""</span></span> class=<span style=<span style="color: #ff0000;">"color: #ff0000;"</span>><span style="color: #ff0000;">"li1"</span></span>> </li></ol></div></li></ol></div></li></ol></div>[/xml] tags please.try this: object1 = createObject(986, 2497.3999023438, 2777.3000488281, 11.5, 0, 0, 270.24169921875) -- right gate object2 = createObject(985, 2497.3000488281, 2769.3000488281, 11.5, 0, 0, 270.24169921875) -- left gate function gateo(player) -- moving the gates function moveObject(object1, 3000, 2497.099609375, 2785.099609375, 11.5, 0, 0, 0) -- opening the gates moveObject(object2, 3000, 2497.3999023438, 2761, 11.5, 0, 0, 0) -- opening the gates setTimer(gatec,5000,1) --set timer to close gates after 5 secs end function gatec(player) -- closing the gates function moveObject(object1, 3000, 2497.1000976563, 2785.1000976563, 11.5, 0, 0, 0 ) -- closing the gates moveObject(object2, 3000, 2497.5, 2761.099609375, 11.5, 0, 0, 0) -- closing the gates end addCommandHandler("nopedotavi", gateo) Thank you but it doesn't work. It moves back just a BIT like a centimetre and then it is stucked there... NVM I fixed it somehow. Thanks for your help I really appreciate it!! Link to comment
Jaysds1 Posted March 9, 2013 Share Posted March 9, 2013 np, and I've edited the code again just in-case you want it 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