Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RequestModel(GetHashKey("titan"))
- while not HasModelLoaded(GetHashKey("titan")) do
- RequestModel(GetHashKey("titan"))
- Citizen.Wait(0)
- end
- local aircraft = CreateVehicle(GetHashKey("titan"), Config.AirplaneSpawn.x, Config.AirplaneSpawn.y, Config.AirplaneSpawn.z, Config.AirplaneSpawn.h, true, true)
- SetEntityHeading(aircraft, Config.AirplaneSpawn.x)
- NetworkSetEntityInvisibleToNetwork(aircraft, true)
- SetEntityHeading(aircraft, heading)
- SetVehicleDoorsLocked(aircraft, 2) -- lock the doors so pirates don't get in
- SetEntityDynamic(aircraft, true)
- ActivatePhysics(aircraft)
- SetVehicleForwardSpeed(aircraft, 60.0)
- SetHeliBladesFullSpeed(aircraft) -- works for planes I guess cred https://github.com/Vechro/cratedrop/blob/master/cratedrop/cratedrop_client.lua#L127
- SetVehicleEngineOn(aircraft, true, true, false)
- ControlLandingGear(aircraft, 3) -- retract the landing gear
- SetEntityProofs(aircraft, true, false, true, false, false, false, false, false)
- RequestModel(GetHashKey("s_m_m_pilot_02"))
- while not HasModelLoaded(GetHashKey("s_m_m_pilot_02")) do
- RequestModel(GetHashKey("s_m_m_pilot_02"))
- Citizen.Wait(0)
- end
- local pilot = CreatePedInsideVehicle(aircraft, 1, GetHashKey("s_m_m_pilot_02"), -1, true, true)
- NetworkSetEntityInvisibleToNetwork(pilot, true)
- SetBlockingOfNonTemporaryEvents(pilot, true) -- ignore explosions and other shocking events
- SetPedRandomComponentVariation(pilot, false)
- SetPedKeepTask(pilot, true)
- SetPlaneMinHeightAboveTerrain(aircraft, 50) -- the plane shouldn't dip below the defined altitude
- TaskVehicleDriveToCoord(pilot, aircraft, Config.AirplaneSpawn.x2, Config.AirplaneSpawn.y2, Config.AirplaneSpawn.z2, 60.0, 0, GetHashKey("titan"), 262144, 15.0, -1.0)
- DoScreenFadeIn(1500)
- Wait(250)
- TaskWarpPedIntoVehicle(PlayerPedId(), aircraft, 1)
- NetworkSetEntityInvisibleToNetwork(PlayerPedId(), true)
- local inPlane = true
- while inPlane do
- Wait(0)
- BeginTextCommandDisplayHelp('STRING')
- AddTextComponentSubstringPlayerName('~INPUT_ENTER~ eject')
- EndTextCommandDisplayHelp(0, false, true, -1)
- if IsControlPressed(0, 23) then
- GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("gadget_parachute"), 1, false, false)
- inPlane = false
- DeleteVehicle(aircraft)
- DeleteEntity(pilot)
- NetworkSetEntityInvisibleToNetwork(PlayerPedId(), false)
- end
- if GetDistanceBetweenCoords(GetEntityCoords(aircraft), Config.AirplaneSpawn.x2, Config.AirplaneSpawn.y2, Config.AirplaneSpawn.z2, false) < 400.0 then
- GiveWeaponToPed(PlayerPedId(), GetHashKey("gadget_parachute"), 1, false, false)
- SetEntityCoords(PlayerPedId(), GetEntityCoords(PlayerPedId()))
- DeleteVehicle(aircraft)
- DeleteEntity(pilot)
- inPlane = false
- end
- end
- while not IsPedInParachuteFreeFall(PlayerPedId()) do
- Wait(50)
- end -- wait until free fall
- Wait(1000)
- while GetEntityHeightAboveGround(PlayerPedId()) >= 20 do
- Wait(0)
- if GetPedParachuteState(PlayerPedId()) ~= (2 or 1) and GetEntityHeightAboveGround(PlayerPedId()) >= 205 then
- BeginTextCommandDisplayHelp('STRING')
- AddTextComponentSubstringPlayerName('~INPUT_ENTER~ open parachute')
- EndTextCommandDisplayHelp(0, false, true, -1)
- else
- BeginTextCommandDisplayHelp('STRING')
- AddTextComponentSubstringPlayerName('~INPUT_ENTER~ close parachute')
- EndTextCommandDisplayHelp(0, false, true, -1)
- end
- if IsControlJustReleased(0, 23) and GetEntityHeightAboveGround(PlayerPedId()) >= 205 then
- if GetPedParachuteState(PlayerPedId()) ~= (2 or 1) then -- F
- GiveWeaponToPed(PlayerPedId(), GetHashKey("gadget_parachute"), 1, false, false)
- ForcePedToOpenParachute(PlayerPedId())
- else
- ClearPedTasks(PlayerPedId())
- end
- end
- if GetEntityHeightAboveGround(PlayerPedId()) <= 200.0 and GetPedParachuteState(PlayerPedId()) ~= (2 or 1) then
- GiveWeaponToPed(PlayerPedId(), GetHashKey("gadget_parachute"), 1, false, false)
- ForcePedToOpenParachute(PlayerPedId())
- break
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement