Jump to content

I Need Help with my Gate Script


FlaroxFX

Recommended Posts

Hey,

Today I tried a gate to scripts,

the gate was set by the script,

but it does not move when I want to move the gate,

so when I type the command,

Can anyone help me?

Here the script:

gate = createObject(980, -3117.3000488281, 471, 14.39999961853, 0, 0, 270)

function opengate()

moveObject(gate, 3000, -3117.3000488281, 471, 8.7)

end

addCommandHandler("test", opengate)

function closegate()

moveObject(gate, 3000, -3117.3000488281, 471, 14.39999961853)

end

addCommandHandler("test1", closegate)start

Did I something wrong?

Please Help !?!

Link to comment
  
local gate1 = createObject(980, -3117.3000488281, 471, 14.39999961853, 0, 0, 270) --the gate pos 
  
  
  
function Gate1(player) 
        if not getElementData(player,"gater1") == true then 
        setElementData(player,"gater1",true) 
        moveObject(gate1, 3000, -3117.3000488281, 471, 8.7)-- this is when the gate open position 
        else 
        if getElementData(player,"gater1") == true then 
        setElementData(player,"gater1",false) 
        moveObject(gate1,  3000, -3117.3000488281, 471, 14.39999961853)-- this is when gate close position 
    end 
end 
end 
addCommandHandler ("test", Gate1) -- to open the gate 

with same command it close/open

Link to comment

local gate1 = createObject(980, -2131.6999511719, 504.20001220703, 36.799999237061, 0, 0, 270)

function Gate1(player)

if not getElementData(player,"gater1") == true then

setElementData(player,"gater1",true)

moveObject(gate1, 3000, -2131.6999511719, 504.20001220703, 31)

else

if getElementData(player,"gater1") == true then

setElementData(player,"gater1",false)

moveObject(gate1, 3000, -2131.6999511719, 504.20001220703, 36.799999237061)

end

end

end

addCommandHandler ("test", Gate1)

Link to comment
local gate1 = createObject(980, -2131.6999511719, 504.20001220703, 36.799999237061, 0, 0, 270) 
  
  
  
function Gate1(player) 
if not getElementData(player,"gater1") == true then 
setElementData(player,"gater1",true) 
moveObject(gate1, 3000, -2131.6999511719, 504.20001220703, 37.3848484) 
else 
if getElementData(player,"gater1") == true then 
setElementData(player,"gater1",false) 
moveObject(gate1, 3000, -2131.6999511719, 504.20001220703, 36.799999237061) 
end 
end 
end 
addCommandHandler ("test", Gate1) 

Type /test to open and close

Link to comment
local gate1 = createObject(980, -2131.6999511719, 504.20001220703, 36.799999237061, 0, 0, 270) 
local gateopened = false 
  
function Gate1() 
    if not gateopened then 
        moveObject(gate1, 3000, -2131.6999511719, 504.20001220703, 37.3848484) 
        gateopened = true 
    else 
        moveObject(gate1, 3000, -2131.6999511719, 504.20001220703, 36.799999237061) 
        gateopened = false 
    end 
end 
addCommandHandler ("test", Gate1) 

Try this

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...