Jump to content

Need help completing function


heavy air

Recommended Posts

Hi Every body :D

i have working on this function

function launch ( player, command )

local x, y, z = getElementPosition ( player )

local theVehicle = getPlayerOccupiedVehicle ( player )

local a,b,r = getVehicleRotation ( theVehicle )

x = x - math.sin ( math.rad® ) * 20

y = y + math.cos ( math.rad® ) * 20

ramp = createObject ( 1633, x, y, z, 0, 0, r )

setTimer ( RemoveRamp, 999999, 1, ramp )

local veh = getPlayerOccupiedVehicle ( player )

local vx, vy, vz = getElementVelocity ( veh )

setElementVelocity ( veh, vx*10, vy*10, vz*10 )

setTimer ( setVehicleModel, 10, 1, "511" )

end

what i want to do is spawn a ramp / jump it really fast ( to get airborne ) / and turn into a plane ( used setTimer so it would change vehicle once im airborne

the ramp and the speed up work fine but it doesnt change vehicle :(

i have tried calling another change vehicle function i nthe script but that didnt work either

ANY IDEAS :roll: Thanx for Lookin :D

Link to comment
  
function launch ( player, command ) 
local x, y, z = getElementPosition ( player ) 
local theVehicle = getPlayerOccupiedVehicle ( player ) 
local a,b,r = getVehicleRotation ( theVehicle ) 
x = x - math.sin ( math.rad(r) ) * 20 
y = y + math.cos ( math.rad(r) ) * 20 
ramp = createObject ( 1633, x, y, z, 0, 0, r ) 
setTimer ( RemoveRamp, 999999, 1, ramp ) 
local veh = getPlayerOccupiedVehicle ( player ) 
local vx, vy, vz = getElementVelocity ( veh ) 
setElementVelocity ( veh, vx*10, vy*10, vz*10 ) 
setTimer ( setVehicleModel ( The Vehicle, 511 ), 1000, 1) 
end 
  

Your syntax for setTimer is wrong, I dont really know whats wrong but try the one posted above.

Link to comment

thanx buddy

i thought i had the syntax for timer right going by the mta wiki

ill give it a try now :D

Have just tried it and mostly works but still get bad argument for set timer

ramp spawns / vehicle boosts / vehicle changes but all at the same time

usually end up destroying the plane because it hits the ramp

will keep tryin and see what i can figure out

still not sure what i did wrong in the syntax for timer

on the mta wiki it says optional argument should be at end of line and i thought thats where i should put the vehicle id

thanks for the help again JUMBA u really know your stuff

THANX AGAIN :D

EDIT : 8)

got it workin

function launch ( player, command )

local x, y, z = getElementPosition ( player )

local theVehicle = getPlayerOccupiedVehicle ( player )

local a,b,r = getVehicleRotation ( theVehicle )

x = x - math.sin ( math.rad® ) * 20

y = y + math.cos ( math.rad® ) * 20

ramp = createObject ( 1633, x, y, z, 0, 0, r )

setTimer ( RemoveRamp, 999999, 1, ramp )

local veh = getPlayerOccupiedVehicle ( player )

local vx, vy, vz = getElementVelocity ( veh )

setElementVelocity ( veh, vx*10, vy*10, vz*10 )

setTimer ( setVehicleModel, 500, 1, theVehicle, 511 )

end

function RemoveRamp (ramp)

destroyElement(ramp)

end

need to reduce the speed boost a bit though / when your drivin fast car tends to flip and plane spawns upside down :shock:

THANX for the help once again JUMBA u rock

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