Hi guys here is my basic eject script, it doesnt exactly sling shot the player up but warps the player by increasing his z value o his current coordinates,, and the movement of camera makes it look like the person has ejected from the vehicle, but the problem is as its getting warped sometimes if some roof or etc is above u , it looks as if u are going through a wall, so i need a way to restrict eject when the area above is not clear.
function eject( player )
local vehicle = getPedOccupiedVehicle(player)
local driver = getVehicleOccupant(vehicle, 0)
local x,y,z = getElementPosition( vehicle )
setElementVelocity(driver, 5, 5, 5)
removePedFromVehicle(driver)
setElementPosition ( driver,x, y, z + 100 )
giveWeapon ( driver, 46, 1 )
end
addCommandHandler("eject", eject)