From 4d117f3a0f76e445af4877f005a822c6dd780a3a Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:43:09 +0100 Subject: [PATCH] chore: garage reconstruction for a more realistic system This PR introduces an important reconstruction of the property vehicle storage system (public garages) --- .../esx_garage/client/antidespawn.lua | 2 +- .../[esx_addons]/esx_garage/client/main.lua | 14 +++-------- .../[esx_addons]/esx_garage/config.lua | 24 +------------------ .../[esx_addons]/esx_garage/fxmanifest.lua | 2 +- .../[esx_addons]/esx_garage/locales/en.lua | 3 --- .../[esx_addons]/esx_garage/locales/it.lua | 3 --- .../[esx_addons]/esx_garage/nui/ui.html | 5 ++-- .../[esx_addons]/esx_garage/server/main.lua | 2 ++ 8 files changed, 10 insertions(+), 45 deletions(-) diff --git a/server-data/resources/[esx_addons]/esx_garage/client/antidespawn.lua b/server-data/resources/[esx_addons]/esx_garage/client/antidespawn.lua index 6cd1d0803..ae18c8b25 100644 --- a/server-data/resources/[esx_addons]/esx_garage/client/antidespawn.lua +++ b/server-data/resources/[esx_addons]/esx_garage/client/antidespawn.lua @@ -1,5 +1,5 @@ local model, coords, heading -local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z + 1.0, heading, true, false) +local vehicle = CreateVehicle(model, GetEntityCoords(coords), GetEntityHeading(heading), 1, 0, false, false) SetVehicleNeedsToBeHotwired(vehicle, false) SetVehicleHasBeenOwnedByPlayer(vehicle, true) diff --git a/server-data/resources/[esx_addons]/esx_garage/client/main.lua b/server-data/resources/[esx_addons]/esx_garage/client/main.lua index 6f5325bd6..33c77baef 100644 --- a/server-data/resources/[esx_addons]/esx_garage/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_garage/client/main.lua @@ -1,3 +1,5 @@ +---@diagnostic disable: undefined-global + local LastMarker, LastPart, thisGarage, thisPound = nil, nil, nil, nil local next = next local nearMarker, menuIsShowed = false, false @@ -13,9 +15,6 @@ AddEventHandler("esx_garage:closemenu", function() hideAll = true, }) - if not menuIsShowed and thisGarage then - ESX.TextUI(TranslateCap("access_parking")) - end if not menuIsShowed and thisPound then ESX.TextUI(TranslateCap("access_Impound")) end @@ -85,7 +84,6 @@ CreateThread(function() SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName(TranslateCap("parking_blip_name")) EndTextCommandSetBlipName(blip) end @@ -106,15 +104,9 @@ end) AddEventHandler("esx_garage:hasEnteredMarker", function(name, part) if part == "EntryPoint" then - local isInVehicle = IsPedInAnyVehicle(ESX.PlayerData.ped, false) + local _ = IsPedInAnyVehicle(ESX.PlayerData.ped, false) local garage = Config.Garages[name] thisGarage = garage - - if isInVehicle then - ESX.TextUI(TranslateCap("park_veh")) - else - ESX.TextUI(TranslateCap("access_parking")) - end end if part == "GetOutPoint" then diff --git a/server-data/resources/[esx_addons]/esx_garage/config.lua b/server-data/resources/[esx_addons]/esx_garage/config.lua index 0527437d4..7c99ac8b3 100644 --- a/server-data/resources/[esx_addons]/esx_garage/config.lua +++ b/server-data/resources/[esx_addons]/esx_garage/config.lua @@ -39,29 +39,6 @@ Config.Garages = { y = -886.5, z = 31.0, }, - SpawnPoint = { - x = -309.3, - y = -897.0, - z = 31.0, - heading = 351.8, - }, - Sprite = 357, - Scale = 0.8, - Colour = 3, - ImpoundedName = "LosSantos", - }, - SanAndreasAvenue = { - EntryPoint = { - x = 216.4, - y = -786.6, - z = 30.8, - }, - SpawnPoint = { - x = 218.9, - y = -779.7, - z = 30.8, - heading = 338.8, - }, Sprite = 357, Scale = 0.8, Colour = 3, @@ -126,6 +103,7 @@ Config.Impounds = { exports("getGarages", function() return Config.Garages end) + exports("getImpounds", function() return Config.Impounds end) diff --git a/server-data/resources/[esx_addons]/esx_garage/fxmanifest.lua b/server-data/resources/[esx_addons]/esx_garage/fxmanifest.lua index b80baf0eb..646a70d96 100644 --- a/server-data/resources/[esx_addons]/esx_garage/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx_garage/fxmanifest.lua @@ -12,7 +12,7 @@ shared_script("@es_extended/imports.lua") server_scripts({ "@es_extended/locale.lua", "locales/*.lua", "@oxmysql/lib/MySQL.lua", "config.lua", "server/main.lua" }) -client_scripts({ "@es_extended/locale.lua", "locales/*.lua", "config.lua", "client/main.lua" }) +client_scripts({ "@es_extended/locale.lua", "locales/*.lua", "config.lua", "client/*.lua" }) ui_page("nui/ui.html") diff --git a/server-data/resources/[esx_addons]/esx_garage/locales/en.lua b/server-data/resources/[esx_addons]/esx_garage/locales/en.lua index 38adcf821..9a165b7fe 100644 --- a/server-data/resources/[esx_addons]/esx_garage/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_garage/locales/en.lua @@ -1,9 +1,6 @@ Locales["en"] = { - ["parking_blip_name"] = "Garage", ["Impound_blip_name"] = "Impound", - ["access_parking"] = "press [E] to access the car park.", ["access_Impound"] = "press [E] to access the impound.", - ["park_veh"] = "press [E] to park the vehicle.", ["not_owning_veh"] = "You do not own this vehicle!", ["veh_released"] = "Successfully Retrieved Vehicle.", ["veh_Impound_released"] = "Successfully Retrieved Vehicle From Impound.", diff --git a/server-data/resources/[esx_addons]/esx_garage/locales/it.lua b/server-data/resources/[esx_addons]/esx_garage/locales/it.lua index f3be9c2cd..9e39070d7 100644 --- a/server-data/resources/[esx_addons]/esx_garage/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_garage/locales/it.lua @@ -1,9 +1,6 @@ Locales["it"] = { - ["parking_blip_name"] = "Garage", ["Impound_blip_name"] = "Sequestro", - ["access_parking"] = "premi [E] per accedere al parcheggio.", ["access_Impound"] = "premi [E] per accedere al sequestro.", - ["park_veh"] = "premi [E] per parcheggiare il veicolo.", ["not_owning_veh"] = "non possiedi questo veicolo!", ["veh_released"] = " Veicolo recuperato con successo. ", ["veh_Impound_released"] = " Veicolo recuperato con successo dal sequestro. ", diff --git a/server-data/resources/[esx_addons]/esx_garage/nui/ui.html b/server-data/resources/[esx_addons]/esx_garage/nui/ui.html index d8c4b7e7f..e1aa13b69 100644 --- a/server-data/resources/[esx_addons]/esx_garage/nui/ui.html +++ b/server-data/resources/[esx_addons]/esx_garage/nui/ui.html @@ -8,10 +8,9 @@