SHARE
TWEET

Zniszczenia silnika

a guest Jun 19th, 2019 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function GetVehHealthPercent()
  2.     local ped = GetPlayerPed(-1)
  3.     local vehicle = GetVehiclePedIsUsing(ped)
  4.     local vehiclehealth = GetEntityHealth(vehicle) - 100
  5.     local maxhealth = GetEntityMaxHealth(vehicle) - 100
  6.     local procentage = (vehiclehealth / maxhealth) * 100
  7.     return procentage
  8. end
  9.  
  10.  
  11.  
  12.  
  13. function ShowNotification(text)
  14.     SetNotificationTextEntry("STRING")
  15.     AddTextComponentString(text)
  16.     DrawNotification(false, false)
  17. end
  18.  
  19.  
  20. Citizen.CreateThread(function()
  21.     while true do
  22.     Citizen.Wait(0)
  23.         local ped = GetPlayerPed(-1)
  24.         local vehicle = GetVehiclePedIsUsing(ped)
  25.         local damage = GetVehHealthPercent(vehicle)
  26.         if IsPedInAnyVehicle(ped, false) then
  27.             SetPlayerVehicleDamageModifier(PlayerId(), 100) -- Seems to not work at the moment --
  28.             if damage < 85 then
  29.                 SetVehicleUndriveable(vehicle, false)
  30.                 ShowNotification("~g~Vehicle is too damaged.")
  31.             end
  32.         end
  33.     end
  34. 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