overlocus Posted August 18, 2018 Posted August 18, 2018 I am using createVehicle code. How can I change the direction of vehicles
DiGiTal Posted August 18, 2018 Posted August 18, 2018 how direction ? (xyz, rx,ry,rz can help u) 1 Our Website : https://tutoplayfun.ml/ Our Discord: https://discord.gg/BxkW65z
xXGhostXx Posted August 18, 2018 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 !
overlocus Posted August 18, 2018 Author Posted August 18, 2018 17 minutes ago, DiGiTal said: how direction ? (xyz, rx,ry,rz can help u) dont make pls teach to me
Moderators IIYAMA Posted August 18, 2018 Moderators 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 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
DiGiTal Posted August 18, 2018 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 Our Website : https://tutoplayfun.ml/ Our Discord: https://discord.gg/BxkW65z
Keiichi1 Posted August 18, 2018 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
JeViCo Posted August 18, 2018 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
overlocus Posted August 18, 2018 Author 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
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