Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetVehHealthPercent()
- local ped = GetPlayerPed(-1)
- local vehicle = GetVehiclePedIsUsing(ped)
- local vehiclehealth = GetEntityHealth(vehicle) - 100
- local maxhealth = GetEntityMaxHealth(vehicle) - 100
- local procentage = (vehiclehealth / maxhealth) * 100
- return procentage
- end
- function ShowNotification(text)
- SetNotificationTextEntry("STRING")
- AddTextComponentString(text)
- DrawNotification(false, false)
- end
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- local ped = GetPlayerPed(-1)
- local vehicle = GetVehiclePedIsUsing(ped)
- local damage = GetVehHealthPercent(vehicle)
- if IsPedInAnyVehicle(ped, false) then
- SetPlayerVehicleDamageModifier(PlayerId(), 100) -- Seems to not work at the moment --
- if damage < 85 then
- SetVehicleUndriveable(vehicle, false)
- ShowNotification("~g~Vehicle is too damaged.")
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement