Guest User

0x7C9E45A4CED2E8DA

a guest
Mar 29th, 2026
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.78 KB | None | 0 0
  1. local devamke_id = 0
  2. RegisterCommand("gobaloongo",function(src,args,raw)
  3.     devamke_id = devamke_id + 1
  4.     local myId = devamke_id
  5.  
  6.     local speed = tonumber(args[1]) or 0.0
  7.     local autopower = tonumber(args[2]) or 0
  8.     local heightOffset = tonumber(args[3]) or 30.0  -- terrain üzerindeki uçuş yüksekliği (metre)
  9.  
  10.     local player = PlayerPedId()
  11.     local vehicle = GetVehiclePedIsIn(player, false)
  12.  
  13.     if not vehicle or vehicle == 0 then
  14.         print("Araç bulunamadı!")
  15.         return
  16.     end
  17.  
  18.     local targetCoords = GetWaypointCoords()
  19.     print("Hedef waypoint: " .. tostring(targetCoords))
  20.  
  21.     if targetCoords.x == 0.0 and targetCoords.y == 0.0 then
  22.         print("Waypoint ayarlı değil!")
  23.         return
  24.     end
  25.     local vehicleCoords = GetEntityCoords(vehicle)
  26.     local dx = targetCoords.x - vehicleCoords.x
  27.     local dy = targetCoords.y - vehicleCoords.y
  28.     local targetHeading = math.deg(math.atan(-dx, dy)) % 360
  29.     print("Araç hedefe döndürüldü, heading: " .. tostring(targetHeading))
  30.  
  31.     -- Adım 2: Hareket etmeden önce aracı olduğu yerde yükselt
  32.     local startTerrainZ, _n = Citizen.InvokeNative(0x2A29CA9A6319E6AB, vehicleCoords.x, vehicleCoords.y, vehicleCoords.z + 50.0, Citizen.PointerValueFloat(), Citizen.PointerValueVector())
  33.     local hoverZ = startTerrainZ + heightOffset
  34.     if startTerrainZ == 0.0 then
  35.         startTerrainZ = vehicleCoords.z
  36.         hoverZ = startTerrainZ
  37.     end
  38.     Citizen.InvokeNative(0x7C9E45A4CED2E8DA,vehicle,1.0)
  39.     print("Kalkış başlıyor... Hedef İrtifa: " .. tostring(hoverZ))
  40.     local fixCoords = GetEntityCoords(vehicle)
  41.     while myId == devamke_id do
  42.         vehicleCoords = GetEntityCoords(vehicle)
  43.         if vehicleCoords.z >= hoverZ - 15.0 then
  44.             print("Seyir irtifasına ulaşıldı!")
  45.             SetEntityRotation(vehicle, 0.0, 0.0, targetHeading, 1, true)
  46.             break
  47.         end
  48.  
  49.         local zStep = vehicleCoords.z + 0.5
  50.         if zStep > hoverZ then zStep = hoverZ end
  51.         print(" zStep",zStep,  " hoverZ", hoverZ)
  52.  
  53.         Citizen.InvokeNative(0x2200AB13CBD10F4E, vehicle, fixCoords.x, fixCoords.y, hoverZ, autopower, speed * 0.5)
  54.         if autopower ~= 0 then
  55.             Citizen.InvokeNative(0xB42C87521D1BDD2F, vehicle, 0.0, 0.0, 0.0)
  56.         end
  57.         Wait(0)
  58.     end
  59.  
  60.     -- Adım 3: Hedefe doğru ilerle
  61.     local lastZ = 0.0
  62.     while myId == devamke_id do
  63.         vehicleCoords = GetEntityCoords(vehicle)
  64.         local ddx = targetCoords.x - vehicleCoords.x
  65.         local ddy = targetCoords.y - vehicleCoords.y
  66.         local dist = math.sqrt(ddx * ddx + ddy * ddy)
  67.  
  68.         if dist < 15.0 then
  69.             print("Hedefe ulaşıldı!")
  70.             devamke_id = devamke_id + 1
  71.             break
  72.         end
  73.  
  74.         local lookAheadDist = math.min(30.0, dist)
  75.         SetEntityRotation(vehicle, 0.0, 0.0, targetHeading, 1, true)
  76.  
  77.         local ileri = Citizen.InvokeNative(0x1899F328B0E12848, vehicle, 0.0, 10.0, 0.0, Citizen.ResultAsVector())
  78.         local terrainZ, normal = Citizen.InvokeNative(0x2A29CA9A6319E6AB, ileri.x, ileri.y, vehicleCoords.z + 50.0, Citizen.PointerValueFloat(), Citizen.PointerValueVector())
  79.        
  80.         lastZ = terrainZ
  81.         local targetZ
  82.         if terrainZ ~= 0.0 then
  83.             targetZ = terrainZ + heightOffset
  84.         else
  85.             targetZ = vehicleCoords.z
  86.         end
  87.  
  88.         drawMarkerAtCoords(ileri, {0, 255, 0, 255})                            
  89.         drawMarkerAtCoords(vector3(ileri.x, ileri.y, targetZ), {0, 0, 0, 255})                            
  90.  
  91.         Citizen.InvokeNative(0x2200AB13CBD10F4E, vehicle, targetCoords.x, targetCoords.y, targetZ, autopower, speed)
  92.         if autopower ~= 0 then
  93.             Citizen.InvokeNative(0xB42C87521D1BDD2F, vehicle, 0.0, 0.0, 0.0)
  94.         end
  95.         Wait(0)
  96.     end
  97.  
  98.     -- Adım 4: Konuma ulaştıktan sonra yavaşça yere in
  99.     print("İniş başlıyor...")
  100.     while true do
  101.         vehicleCoords = GetEntityCoords(vehicle)
  102.  
  103.         local zDownStep = vehicleCoords.z - 0.5
  104.         if zDownStep < lastZ then zDownStep = lastZ end
  105.        
  106.         if vehicleCoords.z <= lastZ + 2.0 then
  107.             print("İniş tamamlandı!")
  108.             Citizen.InvokeNative(0x2200AB13CBD10F4E, vehicle, targetCoords.x, targetCoords.y, zDownStep, 0, 0)
  109.             break
  110.         end
  111.        
  112.  
  113.         SetEntityRotation(vehicle, 0.0, 0.0, targetHeading, 1, true)
  114.         Citizen.InvokeNative(0x2200AB13CBD10F4E, vehicle, targetCoords.x, targetCoords.y, zDownStep, autopower, speed * 0.5)
  115.         if autopower ~= 0 then
  116.             Citizen.InvokeNative(0xB42C87521D1BDD2F, vehicle, 0.0, 0.0, 0.0)
  117.         end
  118.         drawMarkerAtCoords(vector3(targetCoords.x, targetCoords.y, lastZ), {0, 255, 0, 255})      
  119.         Wait(0)
  120.     end
  121. end)
Advertisement
Add Comment
Please, Sign In to add comment