dimos Posted September 7, 2012 Share 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) Link to comment
Castillo Posted September 7, 2012 Share 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) Link to comment
dimos Posted September 7, 2012 Author Share Posted September 7, 2012 please answer and the second Link to comment
Castillo Posted September 7, 2012 Share Posted September 7, 2012 You should use moveObject, not setObjectRotation. Link to comment
dimos Posted September 7, 2012 Author Share Posted September 7, 2012 me only need to move up down no change poss Link to comment
Flaker Posted September 8, 2012 Share 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. Link to comment
dimos Posted September 8, 2012 Author Share Posted September 8, 2012 me need chnage rot Link to comment
Jaysds1 Posted September 8, 2012 Share 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) Link to comment
dimos Posted September 8, 2012 Author Share Posted September 8, 2012 mee need change x and no z and y Link to comment
Jaysds1 Posted September 8, 2012 Share 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 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