Jump to content

[Help] Direction of vehicles


overlocus

Recommended Posts

  • Moderators

@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 by IIYAMA
  • Thanks 1
Link to comment
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 by DiGiTal
  • Thanks 1
Link to comment
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

  • Thanks 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...