Jump to content

How to move an object in sync with a song?


Ryosuke

Recommended Posts

 

 

Object 1831 is attached to the vehicle, how can I move it in sync with a sound even when it is stuck?

 


function Turbo2(player)
if getPedOccupiedVehicle(player) then 
local car = getPedOccupiedVehicle(player)
local carID = getElementModel(car)
if carID == 560 then
PosX = 0
PosZ = 1.4
PosY = 0.4
elseif carID == 422 then
PosX = 0
PosZ = -2.15
PosY = 0.2
else
return
end
if carID == 560 then
ConX = 0
ConZ = 1.4
ConY = 0.4
elseif carID == 422 then
ConX = 0
ConZ = -2.23
ConY = 0.205
else
return
end
x,y,z = getElementPosition(player)
local turbo = createObject(1830, x, y, z+30)
local turbo1 = createObject(1831, x, y, z+30)
 setObjectScale ( turbo, 1.5)
  setObjectScale ( turbo1, 1.5)
attachElements(turbo, car,PosX,PosZ,PosY)
attachElements(turbo1, car,ConX,ConZ,ConY)

-- Modificação
car:setData("obj_1831",turbo1)
-- FIM
addEventHandler ( "onVehicleExplode", root, Exploded )
addEventHandler ( "onPlayerQuit", root, Exploded )
end
end
addCommandHandler("com", Turbo2)

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