Jump to content

Move Vehicle Problem


Recommended Posts

Hello guys, i have a big problem, how can i move a vehicle ( plane ) in the air?

--Aviones
markerPlane = createMarker (3374.5, -1495.5999755859, 10.39999961853, "checkpoint", 20, 0, 0, 900)

local plane1


plane1 = createVehicle(520, 3306.6000976563, -1495.8000488281, 44.700000762939, 0, 0, 269.51831054688)
plane2 = createVehicle(520, 3300.1999511719, -1507.6999511719, 44.700000762939, 0, 0, 269.5166015625)
plane3 = createVehicle(520, 3300.1999511719, -1484.0999755859, 44.700000762939, 0, 0, 269.5166015625)
plane4 = createVehicle(520, 3291.6999511719, -1517.9000244141, 44.7000007629399, 0, 0, 269.5166015625)
plane5 = createVehicle(520, 3292, -1472.9000244141, 44.700000762939, 0, 0, 269.5166015625)
plane6 = createVehicle(520, 3292, -1472.900390625, 44.700000762939, 0, 0, 269.5166015625)
object = createObject (6959, 3473.5, -1496.1999511719, 44.299999237061, 0, 0, 90)
setElementFrozen (plane1, true)
setElementFrozen (plane2, true)
setElementFrozen (plane3, true)
setElementFrozen (plane4, true)
setElementFrozen (plane5, true)
setElementFrozen (plane6, true)

function move1()
	if source == markerPlane then
	moveObject (plane1, 3473.5, -1496.1999511719, 44.299999237061)
	setElementPosition(plane1, 3540.7001953125, -1498.599609375, 15.60000038147)
	end
	end
addEventHandler ("onMarketHit", resourceRoot, move1)

Because the planes are frozen in the air and do not move, unless the setFrozenElement is disabled (they will not move)

http://i.imgur.com/opDAUab.png

Thanks.

Link to post
2 hours ago, EduardoManuelLuna said:

Hello guys, i have a big problem, how can i move a vehicle ( plane ) in the air?


--Aviones
markerPlane = createMarker (3374.5, -1495.5999755859, 10.39999961853, "checkpoint", 20, 0, 0, 900)

local plane1


plane1 = createVehicle(520, 3306.6000976563, -1495.8000488281, 44.700000762939, 0, 0, 269.51831054688)
plane2 = createVehicle(520, 3300.1999511719, -1507.6999511719, 44.700000762939, 0, 0, 269.5166015625)
plane3 = createVehicle(520, 3300.1999511719, -1484.0999755859, 44.700000762939, 0, 0, 269.5166015625)
plane4 = createVehicle(520, 3291.6999511719, -1517.9000244141, 44.7000007629399, 0, 0, 269.5166015625)
plane5 = createVehicle(520, 3292, -1472.9000244141, 44.700000762939, 0, 0, 269.5166015625)
plane6 = createVehicle(520, 3292, -1472.900390625, 44.700000762939, 0, 0, 269.5166015625)
object = createObject (6959, 3473.5, -1496.1999511719, 44.299999237061, 0, 0, 90)
setElementFrozen (plane1, true)
setElementFrozen (plane2, true)
setElementFrozen (plane3, true)
setElementFrozen (plane4, true)
setElementFrozen (plane5, true)
setElementFrozen (plane6, true)

function move1()
	if source == markerPlane then
	moveObject (plane1, 3473.5, -1496.1999511719, 44.299999237061)
	setElementPosition(plane1, 3540.7001953125, -1498.599609375, 15.60000038147)
	end
	end
addEventHandler ("onMarketHit", resourceRoot, move1)

Because the planes are frozen in the air and do not move, unless the setFrozenElement is disabled (they will not move)

http://i.imgur.com/opDAUab.png

Thanks.

  1. plane1 = createVehicle(520, 3306.6000976563, -1495.8000488281, 46.700000762939, 0, 0, 269.51831054688)   --  make the number more t *X* to make it up 
Link to post
5 hours ago, kerolous said:
  1. plane1 = createVehicle(520, 3306.6000976563, -1495.8000488281, 46.700000762939, 0, 0, 269.51831054688)   --  make the number more t *X* to make it up 

Is not working, and i dont know how use this script, i think its the same
 

local heli
heli = createVehicle(417,2876.92383, -1714.63379, 11.04688)
setElementFrozen(heli, true)

function move1()
    local now = getTickCount()
    local elapsedTime = now - startTime
    local duration = endTime - startTime
    local progress = elapsedTime / duration
    
    local x, y, z = interpolateBetween( "here"
                                        progress, "Linear")
    setElementPosition(heli, x, y, z)
end

addEventHandler ("onResourceStart", resourceRoot, move1)

 

Link to post

For the last script, you'll have to paste your starting position, where the heli spawns, and next move to the end position, where you want the heli, and just replace "here" with that position.

  • Like 1
Link to post
On 4/27/2017 at 00:29, NeXuS™ said:

For the last script, you'll have to paste your starting position, where the heli spawns, and next move to the end position, where you want the heli, and just replace "here" with that position.

Is not working, but i try this and work :)

Thanks for you help

local heli
heli = createVehicle (411,2876.92383, -1714.63379, 11.04688) --Vehicle
heli2 = createObject (6959,2876.92383, -1714.63379, 11.04688) --Object 
setObjectScale (heli2, 0) --Scale 0 (object invisible)
attachElementToElement (heli, heli2) --Attach the Vehicle with the Object
setElementFrozen (heli, true) 

function move1(player)
moveObject (heli2, 2000,  2877.87866, -1696.29578, 11.04688) --Move the object
end
addCommandHandler ("move", move1)

 

Link to post

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