Jump to content

createProjectile help


Military Guy

Recommended Posts

How to rotate missile? I attach missile to Packer, works. 

Help pls, im need the missile to fly at an angle

 

 

 


 

function shootProjectile() 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
        -- Only create projectile if we are inside a SWAT 
    if(vehicle) and getVehicleModel(vehicle) == 443 then 
    local x, y, z = getElementPosition(vehicle) 
        createProjectile(vehicle, 19, x, y, z+2)        
    end 
end 
  
function toggleDemControls(bool) 
    toggleControl ( "vehicle_fire", bool ) 
    toggleControl ( "vehicle_secondary_fire", bool) 
end 
  
function swatEnter (player) 
    if player ~= localPlayer then return end 
    local vehicle = getPedOccupiedVehicle(localPlayer) 
    if getElementModel (vehicle) == 443 then 
        toggleDemControls(false) 
        bindKey("vehicle_fire", "down", shootProjectile) 
        bindKey("vehicle_secondary_fire", "down", shootProjectile) 
    end 
end 
addEventHandler ( "onClientVehicleEnter", root, swatEnter )  
  
-- enable vehicle fire when player exits the SWAT, or when he dies 
-- so he can use hunter or anything else. 
  
function enableVehicleFireIfDead () 
    if source ~= localPlayer then return end 
    toggleDemControls(true) 
end 
  
function swatExit (player) 
    if player ~= localPlayer then return end 
    toggleDemControls(true) 
end 
addEventHandler ( "onClientVehicleExit", root, swatExit ) 
addEventHandler ( "onClientPlayerWasted", root, enableVehicleFireIfDead ) 

 


Edited by Military Guy
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...