Merge branch 'dev' into feature/funk

This commit is contained in:
Alec Schitzkat
2026-08-09 00:42:49 +02:00
45 changed files with 3742 additions and 476 deletions
+43
View File
@@ -258,10 +258,12 @@ end
RegisterNUICallback("weather:get", function(_, cb)
local coords = GetEntityCoords(PlayerPedId())
local weather_hash = GetPrevWeatherTypeHashName()
local next_weather_hash = GetNextWeatherTypeHashName()
cb({
success = true,
data = {
condition = weather_types[weather_hash] or "clear",
nextCondition = weather_types[next_weather_hash] or weather_types[weather_hash] or "clear",
region = weather_region(coords),
clock = {
year = GetClockYear(),
@@ -276,6 +278,47 @@ RegisterNUICallback("weather:get", function(_, cb)
})
end)
local function garage_vehicle_kind(model_hash, fallback)
if IsThisModelABoat(model_hash) then
return "boat"
end
if IsThisModelAPlane(model_hash) then
return "plane"
end
if IsThisModelAHeli(model_hash) then
return "helicopter"
end
if IsThisModelABike(model_hash) or IsThisModelABicycle(model_hash) then
return "bike"
end
return fallback
end
RegisterNUICallback("garage:vehicles", function(data, cb)
local result = Bridge.Callbacks.Trigger("sky_phone:garage:vehicles", data)
if not result or not result.success or type(result.data) ~= "table" then
cb(result or { success = false, error = "request_failed" })
return
end
for _, vehicle in ipairs(result.data.vehicles or {}) do
local model_hash = tonumber(vehicle.model)
if not model_hash and type(vehicle.model) == "string" and vehicle.model ~= "" then
model_hash = joaat(vehicle.model)
end
if model_hash then
local display_name = GetDisplayNameFromVehicleModel(model_hash)
local label = display_name and GetLabelText(display_name) or nil
if label and label ~= "NULL" and label ~= "CARNOTFOUND" then
vehicle.name = label
elseif type(vehicle.model) == "string" and vehicle.model ~= "" then
vehicle.name = vehicle.model
end
vehicle.kind = garage_vehicle_kind(model_hash, vehicle.kind)
end
end
cb(result)
end)
for _, callback_name in ipairs(server_callbacks) do
RegisterNUICallback(callback_name, function(data, cb)
local result = Bridge.Callbacks.Trigger("sky_phone:" .. callback_name, data)