SHARE
TWEET

Untitled

a guest Sep 21st, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. RequestModel(GetHashKey("titan"))
  2.     while not HasModelLoaded(GetHashKey("titan")) do
  3.         RequestModel(GetHashKey("titan"))
  4.         Citizen.Wait(0)
  5.     end
  6.  
  7.     local aircraft = CreateVehicle(GetHashKey("titan"), Config.AirplaneSpawn.x, Config.AirplaneSpawn.y, Config.AirplaneSpawn.z, Config.AirplaneSpawn.h, true, true)
  8.     SetEntityHeading(aircraft, Config.AirplaneSpawn.x)
  9.     NetworkSetEntityInvisibleToNetwork(aircraft, true)
  10.     SetEntityHeading(aircraft, heading)
  11.     SetVehicleDoorsLocked(aircraft, 2) -- lock the doors so pirates don't get in
  12.     SetEntityDynamic(aircraft, true)
  13.     ActivatePhysics(aircraft)
  14.     SetVehicleForwardSpeed(aircraft, 60.0)
  15.     SetHeliBladesFullSpeed(aircraft) -- works for planes I guess cred https://github.com/Vechro/cratedrop/blob/master/cratedrop/cratedrop_client.lua#L127
  16.     SetVehicleEngineOn(aircraft, true, true, false)
  17.     ControlLandingGear(aircraft, 3) -- retract the landing gear
  18.     SetEntityProofs(aircraft, true, false, true, false, false, false, false, false)
  19.  
  20.     RequestModel(GetHashKey("s_m_m_pilot_02"))
  21.     while not HasModelLoaded(GetHashKey("s_m_m_pilot_02")) do
  22.         RequestModel(GetHashKey("s_m_m_pilot_02"))
  23.         Citizen.Wait(0)
  24.     end
  25.  
  26.     local pilot = CreatePedInsideVehicle(aircraft, 1, GetHashKey("s_m_m_pilot_02"), -1, true, true)
  27.     NetworkSetEntityInvisibleToNetwork(pilot, true)
  28.     SetBlockingOfNonTemporaryEvents(pilot, true) -- ignore explosions and other shocking events
  29.     SetPedRandomComponentVariation(pilot, false)
  30.     SetPedKeepTask(pilot, true)
  31.     SetPlaneMinHeightAboveTerrain(aircraft, 50) -- the plane shouldn't dip below the defined altitude
  32.     TaskVehicleDriveToCoord(pilot, aircraft, Config.AirplaneSpawn.x2, Config.AirplaneSpawn.y2, Config.AirplaneSpawn.z2, 60.0, 0, GetHashKey("titan"), 262144, 15.0, -1.0)
  33.    
  34.     DoScreenFadeIn(1500)
  35.     Wait(250)
  36.  
  37.     TaskWarpPedIntoVehicle(PlayerPedId(), aircraft, 1)
  38.     NetworkSetEntityInvisibleToNetwork(PlayerPedId(), true)
  39.     local inPlane = true
  40.     while inPlane do
  41.         Wait(0)
  42.         BeginTextCommandDisplayHelp('STRING')
  43.         AddTextComponentSubstringPlayerName('~INPUT_ENTER~ eject')
  44.         EndTextCommandDisplayHelp(0, false, true, -1)
  45.         if IsControlPressed(0, 23) then
  46.             GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("gadget_parachute"), 1, false, false)
  47.             inPlane = false
  48.             DeleteVehicle(aircraft)
  49.             DeleteEntity(pilot)
  50.             NetworkSetEntityInvisibleToNetwork(PlayerPedId(), false)
  51.         end
  52.  
  53.         if GetDistanceBetweenCoords(GetEntityCoords(aircraft), Config.AirplaneSpawn.x2, Config.AirplaneSpawn.y2, Config.AirplaneSpawn.z2, false) < 400.0 then
  54.             GiveWeaponToPed(PlayerPedId(), GetHashKey("gadget_parachute"), 1, false, false)
  55.             SetEntityCoords(PlayerPedId(), GetEntityCoords(PlayerPedId()))
  56.             DeleteVehicle(aircraft)
  57.             DeleteEntity(pilot)
  58.             inPlane = false
  59.         end
  60.  
  61.     end
  62.  
  63.     while not IsPedInParachuteFreeFall(PlayerPedId()) do
  64.         Wait(50)
  65.     end -- wait until free fall
  66.  
  67.     Wait(1000)
  68.  
  69.     while GetEntityHeightAboveGround(PlayerPedId()) >= 20 do
  70.         Wait(0)
  71.         if GetPedParachuteState(PlayerPedId()) ~= (2 or 1) and GetEntityHeightAboveGround(PlayerPedId()) >= 205 then
  72.             BeginTextCommandDisplayHelp('STRING')
  73.             AddTextComponentSubstringPlayerName('~INPUT_ENTER~ open parachute')
  74.             EndTextCommandDisplayHelp(0, false, true, -1)
  75.         else
  76.             BeginTextCommandDisplayHelp('STRING')
  77.             AddTextComponentSubstringPlayerName('~INPUT_ENTER~ close parachute')
  78.             EndTextCommandDisplayHelp(0, false, true, -1)
  79.         end
  80.         if IsControlJustReleased(0, 23) and GetEntityHeightAboveGround(PlayerPedId()) >= 205 then
  81.             if GetPedParachuteState(PlayerPedId()) ~= (2 or 1) then -- F
  82.                 GiveWeaponToPed(PlayerPedId(), GetHashKey("gadget_parachute"), 1, false, false)
  83.                 ForcePedToOpenParachute(PlayerPedId())
  84.             else
  85.                 ClearPedTasks(PlayerPedId())
  86.             end
  87.         end
  88.         if GetEntityHeightAboveGround(PlayerPedId()) <= 200.0 and GetPedParachuteState(PlayerPedId()) ~= (2 or 1) then
  89.             GiveWeaponToPed(PlayerPedId(), GetHashKey("gadget_parachute"), 1, false, false)
  90.             ForcePedToOpenParachute(PlayerPedId())
  91.             break
  92.         end
  93.     end
  94.  
  95. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top