Jump to content

How to manage Projectiles !!


darhal

Recommended Posts

Hi there,

I want to ask if there is any way to manage the direction of the rocket created by

createProjectile 

function !

because i made a script using this function the rocket dont go to the correct direction ! I use

setCameraMatrix 

it s work but when i move its failed ! :(

Link to comment

my formatting sucks but here's one example

bindKey("vehicle_fire", "down", function() 
local assholeinvehcile = getPedOccupiedVehicle(getLocalPlayer()) 
local x, y, z = getElementPosition(assholeinvehcile) 
local m = getElementMatrix(assholeinvehcile) 
local offX = 0 * m[1][1] + 1 * m[2][1] + 0 * m[3][1] + 1 * m[4][1] 
local offY = 0 * m[1][2] + 1 * m[2][2] + 0 * m[3][2] + 1 * m[4][2] 
local offZ = 0 * m[1][3] + 1 * m[2][3] + 0 * m[3][3] + 1 * m[4][3] 
vx = offX - x 
vy = offY - y 
vz = offZ - z 
local rotx, roty, rotz = getElementRotation(assholeinvehcile) 
createProjectile(getLocalPlayer(), 19, x+1, y-0.5, z+0.8, 5000, nil, 0, 0, 360 - rotz, vx, vy, vz) ------- not sure on which angle it is firing, just edit it. 
end) 

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