Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: globalstate rewrite + inventory removal via ox_inventory #621

Merged
merged 4 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ fix lint error: unused argument last; accessing undefined variable Invoke; unuse
78. [esx_progressbar]: refactor: formatting(all): Format with prettier and lua formatter @bitpredator
79. [esx_society]: refactor: (esx_society): complete rebuild for esx_society @bitpredator
80. [npwd]: fix: database error npwd @bitpredator
81. [CayoTwoIslands]: fix: nil value (global 'Config') @bitpredator
81. [CayoTwoIslands]: fix: nil value (global 'Config') @bitpredator
82. [esx_vehicleshop]fix: globalstate rewrite + inventory removal via ox_inventory @bitpredator
10 changes: 1 addition & 9 deletions server-data/resources/[esx]/es_extended/server/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,7 @@ if not Config.OxInventory then
end

function ESX.DoesJobExist(job, grade)
grade = tostring(grade)

if job and grade then
if ESX.Jobs[job] and ESX.Jobs[job].grades[grade] then
return true
end
end

return false
return (ESX.Jobs[job] and ESX.Jobs[job].grades[tostring(grade)] ~= nil) or false
end

function Core.IsPlayerAdmin(playerId)
Expand Down
23 changes: 11 additions & 12 deletions server-data/resources/[esx]/esx_notify/Notify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ local Debug = ESX.GetConfig().EnableDebug
---@param message any the message :D
local function Notify(notificatonType, length, message)
if Debug then
print(('1 %s'):format(tostring(notificatonType)))
print(('2 %s'):format(tostring(length)))
print(('3 %s'):format(message))
print(("1 %s"):format(tostring(notificatonType)))
print(("2 %s"):format(tostring(length)))
print(("3 %s"):format(message))
end

if type(notificatonType) ~= "string" then
Expand All @@ -19,25 +19,24 @@ local function Notify(notificatonType, length, message)
end

if Debug then
print(('4 %s'):format(tostring(notificatonType)))
print(('5 %s'):format(tostring(length)))
print(('6 %s'):format(message))
print(("4 %s"):format(tostring(notificatonType)))
print(("5 %s"):format(tostring(length)))
print(("6 %s"):format(message))
end

SendNuiMessage(json.encode({
type = notificatonType or "info",
length = length or 3000,
message = message or "ESX-Notify"
type = notificatonType,
length = length,
message = message or "ESX-Notify",
}))
end


exports('Notify', Notify)
exports("Notify", Notify)
RegisterNetEvent("ESX:Notify", Notify)

if Debug then
RegisterCommand("oldnotify", function()
ESX.ShowNotification('No Waypoint Set.', true, false, 140)
ESX.ShowNotification("No Waypoint Set.", true, false, 140)
end)

RegisterCommand("notify", function()
Expand Down
4 changes: 2 additions & 2 deletions server-data/resources/[esx_addons]/esx_vehicleshop/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

esx_vehicleshop
Copyright (C) 2015-2022 Jérémie N'gadi
Copyright (C) 2015-2024 Jérémie N'gadi

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

esx_vehicleshop Copyright (C) 2015-2022 Jérémie N'gadi
esx_vehicleshop Copyright (C) 2015-2024 Jérémie N'gadi
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ start esx_vehicleshop

esx_vehicleshop - vehicle shop for ESX

Copyright (C) 2015-2023
Copyright (C) 2015-2024

This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.

Expand Down
575 changes: 346 additions & 229 deletions server-data/resources/[esx_addons]/esx_vehicleshop/client/main.lua

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local NumberCharset = {}
local Charset = {}
local NumberCharset, Charset = {}, {}

for i = 48, 57 do table.insert(NumberCharset, string.char(i)) end

for i = 65, 90 do table.insert(Charset, string.char(i)) end
for i = 97, 122 do table.insert(Charset, string.char(i)) end

Expand All @@ -11,7 +11,7 @@ function GeneratePlate()
local generatedPlate = string.upper(GetRandomLetter(Config.PlateLetters) .. (Config.PlateUseSpace and ' ' or '') .. GetRandomNumber(Config.PlateNumbers))

local isTaken = IsPlateTaken(generatedPlate)
if isTaken then
if isTaken then
return GeneratePlate()
end

Expand All @@ -21,7 +21,7 @@ end
-- mixing async with sync tasks
function IsPlateTaken(plate)
local p = promise.new()

ESX.TriggerServerCallback('esx_vehicleshop:isPlateTaken', function(isPlateTaken)
p:resolve(isPlateTaken)
end, plate)
Expand All @@ -37,4 +37,8 @@ end
function GetRandomLetter(length)
Wait(0)
return length > 0 and GetRandomLetter(length - 1) .. Charset[math.random(1, #Charset)] or ''
end

function TableInsert(t, v)
t[#t + 1] = v
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Config.MarkerColor = {r = 120, g = 120, b = 240}
Config.EnablePlayerManagement = true -- enables the actual car dealer job. You'll need esx_addonaccount, esx_billing and esx_society
Config.ResellPercentage = 50

Config.Locale = 'it'
Config.Locale = 'en'

Config.LicenseEnable = false -- require people to own drivers license when buying vehicles? Only applies if EnablePlayerManagement is disabled. Requires esx_license

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
fx_version 'adamant'
fx_version 'cerulean'
game 'gta5'
lua54 'yes'
description 'ESX Vehicle Shop'

version '0.0.4'
version '1.0.0'

shared_script '@es_extended/imports.lua'

Expand All @@ -12,17 +11,16 @@ server_scripts {
'@es_extended/locale.lua',
'locales/*.lua',
'config.lua',
'server/main.lua'
'server/*.lua'
}

client_scripts {
'@es_extended/locale.lua',
'locales/*.lua',
'config.lua',
'client/utils.lua',
'client/main.lua'
'client/*.lua'
}

dependency 'es_extended'

export 'GeneratePlate'
export 'GeneratePlate'

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ Locales['cs'] = {
['vehicle_set_rented'] = 'vozidlo %s bylo pujceno za %s',
['vehicle_sold_for'] = '%s bylo prodano za $%s',
['vehicle_sold_to'] = 'vozidlo se znackou %s bylo prodano za %s',
['deposit_stock'] = 'vlozit do skladu',
['take_stock'] = 'vybraz ze skladu',
['dealership_stock'] = 'sklad Autosalonu',
['amount'] = 'castka',
['quantity_invalid'] = 'to je neplatne mnozstvi',
['inventory'] = 'inventar',
['dealership'] = 'autodealer',
['dealer_customers'] = 'zakaznici dealera',
['have_withdrawn'] = 'vybral jsi x%s %s',
['have_deposited'] = 'vlozil jsi x%s %s',
['boss_actions'] = 'akce šéfa',
['invalid_vehicle'] = 'neplatné vozidlo',

-- sold vehicles
['boss_sold'] = 'seznam prodaných vozidel',
['customer_client'] = 'jméno zákazníka',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Locales['da'] = {
-- global menus
['not_enough_in_society'] = 'der er ikke nok af ~r~dette item!',
['player_cannot_hold'] = 'du har ~r~ikke nok ledig plads i dit inventar!',
['vehicle_belongs'] = 'et køretøj med nummerpladen %s tilhører nu dig',
['broke_company'] = 'du ikke har penge nok på firmakontoen',
['license_missing'] = 'du har ikke et kørekort!',
['buy_vehicle_shop'] = 'vil du købe %s for DKK%s?',
['buy_vehicle'] = 'køb en bil',
['car_dealer'] = 'Bilforhandler',
['shop_awaiting_model'] = 'køretøjet læsser i øjeblikket, vent venligst',
['create_bill'] = 'opret faktura',
['dealer_boss'] = 'bilforhandler - Cheff',
['delivered'] = 'køretøjet er leveret til forhandleren',
['depop_vehicle'] = 'returner køretøjet til garagen',
['return_provider'] = 'returner køretøjet til udbyderen',
['get_rented_vehicles'] = 'køretøjer til leje',
['no_current_vehicle'] = 'du har i øjeblikket ikke et køretøj udstillet',
['invalid_amount'] = 'ugyldig mængde',
['invoice_amount'] = 'faktura mænge',
['no'] = 'nej',
['yes'] = 'ja',
['no_players'] = 'der er ingen spillere i nærheden af ​​dig',
['not_enough_money'] = 'du har ikke nok penge',
['not_rental'] = 'dette er ikke et ~r~lejet køretøj',
['not_yours'] = 'dette køretøj tilhører ikke dig',
['paid_rental'] = 'du har betalt DKK%s for at leje et køretøj med nummerplade %s',
['paid_rental_evicted'] = 'du ikke havde råd til at betale DKK%s for dit lejede køretøj med nummerpladen %s, det er blevet returneret til forhandleren',
['pop_vehicle'] = 'sæt en bil til salg',
['rent_vehicle'] = 'bilforhandler - Biler til leje',
['return_provider_menu'] = 'bilforhandler - Returner køretøjet til udbyderen',
['rental_amount'] = 'leje mængde',
['sell_menu'] = 'tryk på [E] for at sælge din %s for DKK%s',
['set_vehicle_owner_rent'] = 'lej bil',
['set_vehicle_owner_sell'] = 'sælg bil',
['shop_menu'] = 'tryk [E] for at tilgå menuen',
['generic_shopitem'] = 'DKK%s',
['vehicle_dealer'] = 'bil - bilforhandler',
['vehicle_menu'] = 'tryk på [E] for at give det lejede køretøj tilbage',
['vehicle_purchased'] = 'du købte en bil',
['vehicle_set_owned'] = 'køretøj %s er blevet tildelt til %s',
['vehicle_set_rented'] = 'køretøj %s er blevet lejet til %s',
['vehicle_sold_for'] = '%s er blevet solgt for DKK%s',
['vehicle_sold_to'] = 'køretøjet med plade %s er blevet solgt til %s ',
['deposit_stock'] = 'indsæt antal',
['take_stock'] = 'høv antal',
['dealership_stock'] = 'bilforhandler Mængde',
['amount'] = 'mængde',
['quantity_invalid'] = 'det er en ugyldig mængde',
['inventory'] = 'inventar',
['dealership'] = 'bilforhandler',
['dealer_customers'] = 'kunder',
['have_withdrawn'] = 'du har trukket x%s %s tilbage',
['have_deposited'] = 'du har indsat x%s %s',
['boss_actions'] = 'chef menu',
['invalid_vehicle'] = 'Ugyldigt køretøj',

-- sold vehicles
['boss_sold'] = 'liste over solgte biler',
['customer_client'] = 'kunde navn',
['customer_model'] = 'bil model',
['customer_plate'] = 'bil nummerplads',
['customer_soldby'] = 'solgt af',
['customer_date'] = 'dato',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Locales['de'] = {
-- global menus
['not_enough_in_society'] = 'Es gibt nicht genug von dem Item in der Firma!',
['player_cannot_hold'] = 'Du hast ~r~nicht~r~ genügend freien Platz im Inventar!',
['vehicle_belongs'] = 'Ein Fahrzeug mit dem Kennzeichen %s gehört nun dir!',
['broke_company'] = 'Du hast nicht genug geld im Firmenkonto!',
['license_missing'] = 'Du hast keinen Führerschein!',
['buy_vehicle_shop'] = 'Willst du %s kaufen für %sEUR?',
['buy_vehicle'] = 'Fahrzeug kaufen',
['car_dealer'] = 'Autohändler',
['shop_awaiting_model'] = 'Das Fahrzeug lädt grade, warte bitte!',
['create_bill'] = 'Rechnung Erstellen',
['dealer_boss'] = 'Autohändler - Chef',
['delivered'] = 'Das Fahrzeug wurde zum Händler geliefert',
['depop_vehicle'] = 'Fahrzeug zum Händler bringen',
['return_provider'] = 'Fahrzeug zum besitzer bringen',
['get_rented_vehicles'] = 'Fahrzeuge zum Mieten',
['no_current_vehicle'] = 'Du hast derzeit kein Fahrzeug auf dem Display',
['invalid_amount'] = 'Ungültige Anzahl',
['invoice_amount'] = 'Ungültige Anzahl',
['no'] = 'Nein',
['yes'] = 'Ja',
['no_players'] = 'Es gibt keinen Spieler in deiner Nähe!',
['not_enough_money'] = 'Du hast nicht genug Geld!',
['not_rental'] = 'Das ist kein ~r~miet Fahrzeug',
['not_yours'] = 'Dieses Fahrzeug gehört dir nicht!',
['paid_rental'] = 'Du bezahlst %sEUR um ein Fahrzeug mit dem Kennzeichen %s zu mieten.',
['paid_rental_evicted'] = 'Du kannst dir es nicht leisten %sEUR für deinen Mietwagen zu zahlen. Das Fahrzeug %s, wurde zum Händler zurückgebracht.',
['pop_vehicle'] = 'Fahrzeuge zum verkauf rausfahren',
['rent_vehicle'] = 'Autohändler - Fahrzeuge zum Vermieten',
['return_provider_menu'] = 'Autohändler - Fahrzeug zum Händler bringen',
['rental_amount'] = 'Mietpreis',
['sell_menu'] = 'Drücke [E] um dein %s für %sEUR zu verkaufen!',
['set_vehicle_owner_rent'] = 'Fahrzeug Mieten',
['set_vehicle_owner_sell'] = 'Fahrzeug verkaufen',
['shop_menu'] = 'Drücke [E] um auf das Menü zuzugreifen.',
['generic_shopitem'] = '%sEUR',
['vehicle_dealer'] = 'Fahrzeug - Autohändler',
['vehicle_menu'] = 'Drücke [E] um ein Mietwagen zurückzugeben',
['vehicle_purchased'] = 'Fahrzeug wird gekauft',
['vehicle_set_owned'] = 'Fahrzeug %s wurde an %s gegeben.',
['vehicle_set_rented'] = 'Fahrzeug %s wurde an %s vermietet.',
['vehicle_sold_for'] = 'Das Fahrzeug %s wurde für %sEUR verkauft.',
['vehicle_sold_to'] = 'Das Fahrzeug mit dem Kennzeichen %s wurde verkauft an %s',
['deposit_stock'] = 'Item einlagern',
['take_stock'] = 'Item entnehmen',
['dealership_stock'] = 'Autohändler - Lager',
['amount'] = 'Anzahl',
['quantity_invalid'] = 'Das ist eine Ungültige Anzahl!',
['inventory'] = 'Inventar',
['dealership'] = 'Autohändler',
['dealer_customers'] = 'Autohändler - Kunden',
['have_withdrawn'] = 'Du entnimmst x%s %s',
['have_deposited'] = 'Du lagerst ein x%s %s',
['boss_actions'] = 'Boss Aktionen',
['invalid_vehicle'] = 'Ungültiges Fahrzeug',

-- sold vehicles
['boss_sold'] = 'Liste von Verkauften Fahrzeugen',
['customer_client'] = 'Kundenname',
['customer_model'] = 'Auto Modell',
['customer_plate'] = 'Auto Kennzeichen',
['customer_soldby'] = 'Verkauft von',
['customer_date'] = 'Datum',
}
Loading
Loading