[GARAGE]
This commit is contained in:
parent
a29350c85f
commit
fa136ac8c4
6 changed files with 303 additions and 18 deletions
|
@ -94,8 +94,51 @@ function AddTargetOptions(zone)
|
|||
icon = "fas fa-car",
|
||||
label = "Fahrzeug ausparken",
|
||||
args = zone
|
||||
}
|
||||
},
|
||||
if Config.Verwaltung then
|
||||
{
|
||||
type = "client",
|
||||
event = "mh_garage:verwaltungVeh",
|
||||
icon = "",
|
||||
label = "Fahrzeuge Verwalten",
|
||||
}
|
||||
end
|
||||
},
|
||||
distance = 2.5
|
||||
})
|
||||
end
|
||||
|
||||
function Notification(text, type, zone)
|
||||
lib.notify({
|
||||
title = "Garage - "..zone,
|
||||
description = text,
|
||||
type = type,
|
||||
position = 'top',
|
||||
})
|
||||
end
|
||||
|
||||
---------------------------- NetEvents
|
||||
RegisterNetEvent('mh_jobgarage:notify')
|
||||
AddEventHandler('mh_jobgarage:notify', function(title, text, type)
|
||||
Notification(text, type)
|
||||
end)
|
||||
|
||||
function GetVehicleDamagePercentage(vehicle)
|
||||
if not vehicle then return 0 end
|
||||
|
||||
-- Hole die verschiedenen Gesundheitswerte
|
||||
local engineHealth = GetVehicleEngineHealth(vehicle)
|
||||
local bodyHealth = GetVehicleBodyHealth(vehicle)
|
||||
local tankHealth = GetVehiclePetrolTankHealth(vehicle)
|
||||
|
||||
-- Normalisiere die Werte (Standard-Maximalwerte: 1000.0)
|
||||
local enginePercent = (engineHealth / 1000.0) * 100
|
||||
local bodyPercent = (bodyHealth / 1000.0) * 100
|
||||
local tankPercent = (tankHealth / 1000.0) * 100
|
||||
|
||||
-- Berechne Durchschnitt als Gesamtzustand
|
||||
local totalHealth = (enginePercent + bodyPercent + tankPercent) / 3
|
||||
|
||||
-- Runde auf ganze Zahlen
|
||||
return math.floor(totalHealth)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue