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)