Skip to content

Commit

Permalink
chore: garage reconstruction for a more realistic system
Browse files Browse the repository at this point in the history
This PR introduces an important reconstruction of the property vehicle storage system (public garages)
  • Loading branch information
bitpredator committed Dec 9, 2024
1 parent cf3941e commit 4d117f3
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
14 changes: 3 additions & 11 deletions server-data/resources/[esx_addons]/esx_garage/client/main.lua
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -85,7 +84,6 @@ CreateThread(function()
SetBlipAsShortRange(blip, true)

BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName(TranslateCap("parking_blip_name"))
EndTextCommandSetBlipName(blip)
end

Expand All @@ -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
Expand Down
24 changes: 1 addition & 23 deletions server-data/resources/[esx_addons]/esx_garage/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -126,6 +103,7 @@ Config.Impounds = {
exports("getGarages", function()
return Config.Garages
end)

exports("getImpounds", function()
return Config.Impounds
end)
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
3 changes: 0 additions & 3 deletions server-data/resources/[esx_addons]/esx_garage/locales/en.lua
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
3 changes: 0 additions & 3 deletions server-data/resources/[esx_addons]/esx_garage/locales/it.lua
Original file line number Diff line number Diff line change
@@ -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. ",
Expand Down
5 changes: 2 additions & 3 deletions server-data/resources/[esx_addons]/esx_garage/nui/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
<body>
<div id="container">
<div id="header">
<div class="title" style="display: inline">ESX Garage</div>
<div class="title" style="display: inline">EMPIRETOWN</div>
<ul>
<li data-page="garage" class="selected">Garage</li>
<li data-page="impounded">Impounded</li>
<li data-page="impounded">SEQUESTRO</li>
</ul>
<div class="close">X</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions server-data/resources/[esx_addons]/esx_garage/server/main.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---@diagnostic disable: undefined-global

RegisterServerEvent("esx_garage:updateOwnedVehicle")
AddEventHandler("esx_garage:updateOwnedVehicle", function(stored, parking, Impound, data, spawn)
local source = source
Expand Down

0 comments on commit 4d117f3

Please sign in to comment.