Jump to content

[HELP] Car Rotation


MatreN

Recommended Posts

Posted (edited)
13 hours ago, Tut said:

Why bother, he's asking for help. Nothing to shame him for.

I understand that but cmon... just googling "mta rotation" first result will be the link i gave him. 

K nvm. Im sorry if that was too rude ftom my side

Edited by Emix
  • Like 1
  • Moderators
Posted
11 hours ago, MatreN said:

I'll make a showroom-style system.

A small example/hack to rotate (multiple) vehicles. With very little code.

 

This code is untested

local rotationElement = createElement("rotationElement")
local duration = 1000
addEventHandler("onClienRender", root, 
function () 
	setElementRotation(rotationElement, 0,0, (getTickCount() % duration) / duration * 360 )
end)

 

 

local vehicle1 = createVehicle(--[[ fill in]])
setElementParent(vehicle1, rotationElement)



local vehicle2 = createVehicle(--[[ fill in]])
setElementParent(vehicle2, rotationElement)


local vehicle3 = createVehicle(--[[ fill in]])
setElementParent(vehicle3, rotationElement)


setElementFrozen(rotationElement, true)

 

  • Like 1
Posted
local rotationElement = createElement("rotationElement")
local duration = 1000
addEventHandler("onClienRender", root, 
function () 
	setElementRotation(rotationElement, 0,0, (getTickCount()%20)/30*360) -- Duration Araba Dönüş Hızı
end)

local vehicle1 = createVehicle(2500.1000976563, -1662.5999755859, 13.199999809265)
setElementParent(vehicle1, rotationElement)


local vehicle2 = createVehicle(2499.8999023438, -1673, 13.199999809265)
setElementParent(vehicle2, rotationElement)


local vehicle3 = createVehicle(2491.6999511719, -1667.5999755859, 13.10000038147)
setElementParent(vehicle3, rotationElement)


setElementFrozen(rotationElement, false)

I don't know if I did it right, but the cars don't turn 360 degrees.

Posted
23 minutes ago, MatreN said:

local rotationElement = createElement("rotationElement")
local duration = 1000
addEventHandler("onClienRender", root, 
function () 
	setElementRotation(rotationElement, 0,0, (getTickCount()%20)/30*360) -- Duration Araba Dönüş Hızı
end)

local vehicle1 = createVehicle(2500.1000976563, -1662.5999755859, 13.199999809265)
setElementParent(vehicle1, rotationElement)


local vehicle2 = createVehicle(2499.8999023438, -1673, 13.199999809265)
setElementParent(vehicle2, rotationElement)


local vehicle3 = createVehicle(2491.6999511719, -1667.5999755859, 13.10000038147)
setElementParent(vehicle3, rotationElement)


setElementFrozen(rotationElement, false)

I don't know if I did it right, but the cars don't turn 360 degrees.

are you talk about 360 auto ? or only one?

  • Moderators
Posted (edited)
1 hour ago, MatreN said:

local rotationElement = createElement("rotationElement")
local duration = 1000
addEventHandler("onClienRender", root, 
function () 
	setElementRotation(rotationElement, 0,0, (getTickCount()%20)/30*360) -- Duration Araba Dönüş Hızı
end)

local vehicle1 = createVehicle(2500.1000976563, -1662.5999755859, 13.199999809265)
setElementParent(vehicle1, rotationElement)


local vehicle2 = createVehicle(2499.8999023438, -1673, 13.199999809265)
setElementParent(vehicle2, rotationElement)


local vehicle3 = createVehicle(2491.6999511719, -1667.5999755859, 13.10000038147)
setElementParent(vehicle3, rotationElement)


setElementFrozen(rotationElement, false)

I don't know if I did it right, but the cars don't turn 360 degrees.

Clientside?

 

Btw you are missing an argument: (model)

createVehicle ( int model, float x, float y, float z

 

 

 

Edited by IIYAMA

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...