dimos Posted September 7, 2012 Posted September 7, 2012 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)
Castillo Posted September 7, 2012 Posted September 7, 2012 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)
Castillo Posted September 7, 2012 Posted September 7, 2012 You should use moveObject, not setObjectRotation.
dimos Posted September 7, 2012 Author Posted September 7, 2012 me only need to move up down no change poss
Flaker Posted September 8, 2012 Posted September 8, 2012 me only need to move up down no change poss Try to read description of this func: https://wiki.multitheftauto.com/wiki/MoveObject There is no way to move obj without changing pos.
Jaysds1 Posted September 8, 2012 Posted September 8, 2012 try using setElementRotation only change the z part, the x and y values should stay at 0. example: local z = getPedRotation(localPlayer) setElementRotation(theObject,0,0,z)
Jaysds1 Posted September 8, 2012 Posted September 8, 2012 ok, if you want to make the object move, use moveObject but if you want the object to turn and not move, then use setElementRotation
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