overlocus Posted August 18, 2018 Share Posted August 18, 2018 I am using createVehicle code. How can I change the direction of vehicles Link to comment
DiGiTal Posted August 18, 2018 Share Posted August 18, 2018 how direction ? (xyz, rx,ry,rz can help u) 1 Link to comment
xXGhostXx Posted August 18, 2018 Share Posted August 18, 2018 1 minute ago, DiGiTal said: how direction ? (xyz, rx,ry,rz can help u) @DiGiTal Please check my job system post and help me ! Link to comment
overlocus Posted August 18, 2018 Author Share Posted August 18, 2018 17 minutes ago, DiGiTal said: how direction ? (xyz, rx,ry,rz can help u) dont make pls teach to me Link to comment
Moderators IIYAMA Posted August 18, 2018 Moderators Share Posted August 18, 2018 (edited) @overlocus For example this. setElementPosition(vehicle, 0, 0, 10) -- position setElementRotation(vehicle, 90, 180, 0, "ZYX") -- orientation/rotation Just play with it, until you understand it. (best way of learning) Quick test code: (client / server) do local vehicles = getElementsByType("vehicle") for i=1, #vehicles do local vehicle = vehicles[i] setElementPosition(vehicle, 0, 0, 10) -- position setElementRotation(vehicle, 90, 180, 0, "ZYX") -- orientation/rotation end end Wiki: https://wiki.multitheftauto.com/wiki/SetElementPosition https://wiki.multitheftauto.com/wiki/SetElementRotation Edited August 18, 2018 by IIYAMA 1 Link to comment
DiGiTal Posted August 18, 2018 Share Posted August 18, 2018 (edited) 1 hour ago, IIYAMA said: @overlocus For example this. setElementPosition(vehicle, 0, 0, 10) -- position setElementRotation(vehicle, 90, 180, 0, "ZYX") -- orientation/rotation Just play with it, until you understand it. (best way of learning) Quick test code: (client / server) do local vehicles = getElementsByType("vehicle") for i=1, #vehicles do local vehicle = vehicles[i] setElementPosition(vehicle, 0, 0, 10) -- position setElementRotation(vehicle, 90, 180, 0, "ZYX") -- orientation/rotation end end Wiki: https://wiki.multitheftauto.com/wiki/SetElementPosition https://wiki.multitheftauto.com/wiki/SetElementRotation I GOT all what you wrote but this ? local vehicle = vehicles , can you explaine it .Thanks Edited August 18, 2018 by DiGiTal 1 Link to comment
Keiichi1 Posted August 18, 2018 Share Posted August 18, 2018 (edited) Set the vehicle variable to the vehicles tables' i index, which should be a number. It can be done easier. for i, vehicle in ipairs(getElementsByType("vehicle")) do setElementPosition(vehicle, 0, 0, 10) -- position setElementRotation(vehicle, 90, 180, 0, "ZYX") -- orientation/rotation end Edited August 18, 2018 by Keiichi1 1 Link to comment
JeViCo Posted August 18, 2018 Share Posted August 18, 2018 23 minutes ago, DiGiTal said: local vehicle = vehicles , can you explaine it .Thanks this guy replaced a variable vehicles to use it below. If i write like this setElementPosition(vehicles[i], 0, 0, 10) -- position setElementRotation(vehicles[i], 90, 180, 0, "ZYX") -- orientation/rotation it won't affect the result at all 1 Link to comment
overlocus Posted August 18, 2018 Author Share Posted August 18, 2018 Problem solved thx evrybody vehicle createVehicle ( int model, float x, float y, float z, [ float rx, float ry, float rz ] ) 2 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