Jump to content

i need help it's not work good


dimos

Recommended Posts

https://www.youtube.com/watch?v=BzjB0qgz ... e=youtu.be

local gate = createObject ( 971, 1589, -1638.0999755859, 14.800000190735, 0, 0, 180 )

state = 0

function gate()

if state == 0 then

moveObject( gate, 1589, -1638.0999755859, 7.3000001907349)

state = 1

else

moveObject ( gate, 1589, -1638.0999755859, 14.800000190735)

state = 0

end

end

addCommandHandler( "gate", gate)

gate\gate.lua:5: Bad argument @ 'moveObject' [Expected element at argument 1, got function]

https://www.youtube.com/watch?v=a6FIJaCm ... e=youtu.be

local bar = createObject ( 2920, 1544.6999511719, -1630.8000488281, 13.10000038147, 90, 0, 180 )

state = 0

function barrier()

if state == 0 then

setObjectRotation( bar,0,0,180)

state = 1

else

setObjectRotation( bar, 90, 0, 180)

state = 0

end

end

addCommandHandler ( "gate", barrier)

Link to comment

You named your variable of the object same as the function name.

local gate = createObject ( 971, 1589, -1638.0999755859, 14.800000190735, 0, 0, 180 ) 
state = 0 
  
function moveGate() 
if state == 0 then 
moveObject( gate, 1589, -1638.0999755859, 7.3000001907349) 
state = 1 
else 
moveObject ( gate, 1589, -1638.0999755859, 14.800000190735) 
state = 0 
end 
end 
addCommandHandler( "gate", moveGate) 

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