Jump to content

Closing the gates


Wes

Recommended Posts

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

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 by Guest
Link to comment
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
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 :D.

And... Player argument Its not necesarry

Link to comment
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. :D Thanks for your help I really appreciate it!!

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...