RobbyAJM Posted March 8, 2017 Share Posted March 8, 2017 (edited) Hi, i've try this script in serverside and clientside is does'nt work. This is the original script: local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) local state =0--this is the state, if 0 gate closed if 1 it's open function move() if state ==0then--it's closed so open it moveObject ( gate, Time, New_X, New_Y, New_Z)--Time means how fast the object'ill be moved. state = state +1 elseif state ==1then--it's open so close it moveObject ( gate, Time,Old_X, Old_Y, Old_Z) state = state -1 end end addCommandHandler("gate", move )--this one creates a command "/gate" wich'll start the move function The gate object doesnt spawned, i dont know why, i'm newbie in lua scripting. Please guys help me on fixing. Thanks. Edited March 8, 2017 by RobbyAJM Fix format Link to comment
N3xT Posted March 8, 2017 Share Posted March 8, 2017 local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) local state = 0 function move() if state == 0 then moveObject ( gate, Time, New_X, New_Y, New_Z) state = 1 elseif state == 1 then moveObject ( gate, Time,Old_X, Old_Y, Old_Z) state = 0 end end addCommandHandler("gate", move ) Link to comment
Ayush Rathore Posted March 8, 2017 Share Posted March 8, 2017 (edited) If you are newbie open map editor and then create object and then place it where you want at the first place then double click the object to open a window in which positions and rotation is given note that down and now move that object to the position you want it to be moved and again note the positions and rotation. Now in this code of NTx3 local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) local state = 0 function move() if state == 0 then moveObject ( gate, Time, New_X, New_Y, New_Z) state = 1 elseif state == 1 then moveObject ( gate, Time,Old_X, Old_Y, Old_Z) state = 0 end end addCommandHandler("gate", move ) remove object id with your object id and then place posx,y,z and rotx,y,z you noted first time to the first line of code then where New_X, New_Y, New_Z is written place the posx,y,z you noted second time and then where Old_X,Old_X,Old_X is written place the pos,x,y,z which you placed in line 1 Good Luck! Edited March 8, 2017 by Ayush Rathore Link to comment
RobbyAJM Posted March 10, 2017 Author Share Posted March 10, 2017 On 3/8/2017 at 19:14, N3xT said: local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) local state = 0 function move() if state == 0 then moveObject ( gate, Time, New_X, New_Y, New_Z) state = 1 elseif state == 1 then moveObject ( gate, Time,Old_X, Old_Y, Old_Z) state = 0 end end addCommandHandler("gate", move ) Thankyou N3xT. On 3/8/2017 at 20:29, Ayush Rathore said: If you are newbie open map editor and then create object and then place it where you want at the first place then double click the object to open a window in which positions and rotation is given note that down and now move that object to the position you want it to be moved and again note the positions and rotation. Now in this code of NTx3 local gate = createObject ( ObjID, Pos_X, Pos_Y, Pos_Z, Rot_X, Rot_Y, Rot_Z ) local state = 0 function move() if state == 0 then moveObject ( gate, Time, New_X, New_Y, New_Z) state = 1 elseif state == 1 then moveObject ( gate, Time,Old_X, Old_Y, Old_Z) state = 0 end end addCommandHandler("gate", move ) remove object id with your object id and then place posx,y,z and rotx,y,z you noted first time to the first line of code then where New_X, New_Y, New_Z is written place the posx,y,z you noted second time and then where Old_X,Old_X,Old_X is written place the pos,x,y,z which you placed in line 1 Good Luck! Hi Ayush Rathore, thank you about the information, i'm using using getpos resource to get the cordinates, but nice information, thanks. 1 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