From 730a48396a0d7016b513757a4c3b43a088bfd808 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 28 Jan 2024 11:54:19 +0100 Subject: [PATCH 1/4] fix: globalstate rewrite + inventory removal via ox_inventory - inventory removal via ox_inventory - inventory implementation directly in esx_vehicleshop --- .github/CHANGELOG.md | 3 +- .../[esx_addons]/esx_vehicleshop/LICENSE | 4 +- .../[esx_addons]/esx_vehicleshop/README.md | 2 +- .../esx_vehicleshop/client/main.lua | 575 +++++++++++------- .../esx_vehicleshop/client/utils.lua | 12 +- .../[esx_addons]/esx_vehicleshop/config.lua | 2 +- .../esx_vehicleshop/fxmanifest.lua | 12 +- .../esx_vehicleshop/locales/br.lua | 61 -- .../esx_vehicleshop/locales/cs.lua | 4 + .../esx_vehicleshop/locales/da.lua | 65 ++ .../esx_vehicleshop/locales/de.lua | 65 ++ .../esx_vehicleshop/locales/en.lua | 3 + .../esx_vehicleshop/locales/es.lua | 3 + .../esx_vehicleshop/locales/fi.lua | 113 ++-- .../esx_vehicleshop/locales/fr.lua | 3 + .../esx_vehicleshop/locales/hu.lua | 16 +- .../esx_vehicleshop/locales/it.lua | 9 +- .../esx_vehicleshop/locales/nl.lua | 65 ++ .../esx_vehicleshop/locales/pl.lua | 3 + .../esx_vehicleshop/locales/si.lua | 61 -- .../esx_vehicleshop/locales/sr.lua | 66 ++ .../esx_vehicleshop/locales/sv.lua | 61 -- .../esx_vehicleshop/locales/zh-cn.lua | 65 ++ .../localization/de_esx_vehicleshop.sql | 34 +- .../localization/en_esx_vehicleshop.sql | 2 - .../localization/es_esx_vehicleshop.sql | 2 - .../localization/fi_esx_vehicleshop.sql | 2 - ...vehicleshop.sql => fr_esx_vehicleshop.sql} | 34 +- .../localization/it_esx_vehicleshop.sql | 337 ++++++++++ ...vehicleshop.sql => nl_esx_vehicleshop.sql} | 16 +- .../localization/pl_esx_vehicleshop.sql | 2 - ...vehicleshop.sql => sr_esx_vehicleshop.sql} | 28 +- .../esx_vehicleshop/server/main.lua | 422 ++++++++----- .../[ox]/ox_inventory/data/stashes.lua | 21 +- 34 files changed, 1432 insertions(+), 741 deletions(-) delete mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/locales/br.lua create mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/locales/da.lua create mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/locales/de.lua create mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/locales/nl.lua delete mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/locales/si.lua create mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/locales/sr.lua delete mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/locales/sv.lua create mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/locales/zh-cn.lua rename server-data/resources/[esx_addons]/esx_vehicleshop/localization/{br_esx_vehicleshop.sql => fr_esx_vehicleshop.sql} (95%) create mode 100644 server-data/resources/[esx_addons]/esx_vehicleshop/localization/it_esx_vehicleshop.sql rename server-data/resources/[esx_addons]/esx_vehicleshop/localization/{si_esx_vehicleshop.sql => nl_esx_vehicleshop.sql} (97%) rename server-data/resources/[esx_addons]/esx_vehicleshop/localization/{sv_esx_vehicleshop.sql => sr_esx_vehicleshop.sql} (96%) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index a0b3a8131..8da6d0d0b 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -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 \ No newline at end of file +81. [CayoTwoIslands]: fix: nil value (global 'Config') @bitpredator +82. [esx_vehicleshop]fix: globalstate rewrite + inventory removal via ox_inventory @bitpredator \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/LICENSE b/server-data/resources/[esx_addons]/esx_vehicleshop/LICENSE index f3e09b14b..ab77a6422 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/LICENSE +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/LICENSE @@ -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 @@ -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. diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/README.md b/server-data/resources/[esx_addons]/esx_vehicleshop/README.md index e28361f20..0fa5fe810 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/README.md +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/README.md @@ -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. diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/client/main.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/client/main.lua index 52a853bc9..ed7e2f188 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/client/main.lua @@ -1,50 +1,47 @@ +local Config = Config local HasAlreadyEnteredMarker, IsInShopMenu = false, false local CurrentAction, CurrentActionMsg, LastZone, currentDisplayVehicle, CurrentVehicleData -local CurrentActionData, Vehicles, Categories = {}, {}, {} -local VehiclesByModel = {} -local vehiclesByCategory = {} - -function getVehicleFromModel(model) - return VehiclesByModel[model] -end - -function PlayerManagement() - if not Config.EnablePlayerManagement then - return - end +local CurrentActionData, Vehicles, Categories, VehiclesByModel, vehiclesByCategory, soldVehicles, cardealerVehicles, rentedVehicles = {}, {}, {}, {}, {}, {}, {}, {} +local DoesEntityExist, NetworkRequestControlOfEntity, NetworkHasControlOfEntity, DisableControlAction, HasModelLoaded, RequestModel, DisableAllControlActions, FreezeEntityPosition, SetEntityCoords, SetEntityVisible = DoesEntityExist, NetworkRequestControlOfEntity, NetworkHasControlOfEntity, DisableControlAction, HasModelLoaded, RequestModel, DisableAllControlActions, FreezeEntityPosition, SetEntityCoords, SetEntityVisible + +Vehicles = GlobalState.vehicleShop.vehicles +Categories = GlobalState.vehicleShop.categories +VehiclesByModel = GlobalState.vehicleShop.vehiclesByModel +soldVehicles = GlobalState.vehicleShop.soldVehicles +cardealerVehicles = GlobalState.vehicleShop.cardealerVehicles +rentedVehicles = GlobalState.vehicleShop.rentedVehicles + +AddStateBagChangeHandler('vehicleShop', 'global', function(bagName, key, value) + Vehicles = value.vehicles + Categories = value.categories + VehiclesByModel = value.vehiclesByModel + soldVehicles = value.soldVehicles + cardealerVehicles = value.cardealerVehicles + rentedVehicles = value.rentedVehicles +end) - if ESX.PlayerData.job.name ~= 'cardealer' then - Config.Zones.ShopEntering.Type = -1 - Config.Zones.BossActions.Type = -1 - Config.Zones.ResellVehicle.Type = -1 - return - end - Config.Zones.ShopEntering.Type = 1 +CreateThread(function() + while true do + Wait(60000) + collectgarbage("collect") + end +end) - if ESX.PlayerData.job.grade_name == 'boss' then - Config.Zones.BossActions.Type = 1 - end +local function getVehicleFromModel(model) + return VehiclesByModel[model] end -RegisterNetEvent('esx:playerLoaded') -AddEventHandler('esx:playerLoaded', function(xPlayer) - ESX.PlayerData = xPlayer - - PlayerManagement() - TriggerServerEvent("esx_vehicleshop:getVehiclesAndCategories") -end) +local function Init() + TriggerEvent('esx_vehicleshop:updateTables') -RegisterNetEvent('esx_vehicleshop:updateVehiclesAndCategories', function(vehicles, categories, vehiclesByModel) - Vehicles = vehicles - Categories = categories - - VehiclesByModel = vehiclesByModel + Wait(500) table.sort(Vehicles, function(a, b) return a.name < b.name end) - for _, vehicle in ipairs(Vehicles) do + for i = 1, #Vehicles, 1 do + local vehicle = Vehicles[i] if IsModelInCdimage(joaat(vehicle.model)) then local category = vehicle.category @@ -57,11 +54,76 @@ RegisterNetEvent('esx_vehicleshop:updateVehiclesAndCategories', function(vehicle print(('[^3WARNING^7] Ignoring vehicle ^5%s^7 due to invalid Model'):format(vehicle.model)) end end + + if Config.EnablePlayerManagement then + RegisterNetEvent('esx_phone:loaded') + AddEventHandler('esx_phone:loaded', function(phoneNumber, contacts) + local specialContact = { + name = _U('dealership'), + number = 'cardealer', + base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQAAADMzMzszM0M0M0w0M1Q1M101M2U2M242M3Y3M383Moc4MpA4Mpg5MqE5Mqk6MrI6Mro7Mrw8Mr89M71DML5EO8I+NMU/NcBMLshANctBNs5CN8RULMddKsheKs9YLtBCONZEOdlFOtxGO99HPNhMNsplKM1nKM1uJtRhLddiLt5kMNJwJ9B2JNR/IeNIPeVJPehKPuRQOuhSO+lZOOlhNuloM+p3Lep/KupwMMFORsVYUcplXc1waNJ7delUSepgVexrYe12bdeHH9iIH9qQHd2YG+udH+OEJeuGJ+uOJeuVIuChGeSpF+aqGOykHOysGeeyFeuzFuyzFuq6E+27FO+Cee3CEdaGgdqTjvCNhfKYkvOkngAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJezdycAAAEAdFJOU////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wBT9wclAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGHRFWHRTb2Z0d2FyZQBwYWludC5uZXQgNC4xLjb9TgnoAAAQGElEQVR4Xt2d+WMUtxXHbS6bEGMPMcQQ04aEUnqYo9xJWvC6kAKmQLM2rdn//9+g0uir2Tl0PElPszP7+cnH7Fj6rPTeG2lmvfKld2azk8lk/36L/cnkZDbDIT3Sp4DZ8QS9dTI57tNDTwJOOu+4j/0TvDQz+QXMSG+7mUn+sZBZQELnNROcKhMZBXx+gS4k8+IzTpmBXAJOnqPxTDzPFRKyCODuvSKPgwwC2EZ+lxf4E4xwCzhBU7PBPQx4BWR88+fwDgNGAbMsM9/Ec8bygE3A5966L3nOlhiZBGSf+l2YggGLgBna1DMsE4FBQH9zvw1HLEgX0Evkt5GeEVIFMFztpJF6rZQm4DNasVDSEkKSgIVN/ibP0ZwoEgQsfPTPSZgH8QIG8vYr4gdBrIABvf2K2EEQKWBQb78ichBECRhE8O8SlQ5iBAQvcffFPhoYQoSAAQ5/TcQ0CBYw0OGvCZ4GoQIGF/3bhGaDQAELvfKhERgIwgQMePrPCQsEQQLwFwYPmksiQMCC1n1iCFgooQtYwLJfPPQFQ7KAUfU/wABVwMj6TzdAFDDY6tcOMR3SBIyw/1QDJAGj7D/RAEXA6Oa/hhIHCAJG23+SAb+AEfefYsArYET1nwlvTegVgBONFnTDik8ATjNi0BEbHgGjuP5147k6dgsYaQHQxF0OOAUMfv2LhnOVzCVg4OufdFwrpS4BePkSgA6ZcAhYggCocQRCu4ClCIAaeyC0CliaAKCwhgGrALxwaUC3OtgELFEAUNjCgEXAklQAdSzVgEUAXrRUoGstzAKWbgJIzJPAKGAJJ4DEOAmMAvCCpQPda2ASsJQTQGKaBAYBS1YC1TGUQwYBOHgpQRdrdAUsaQRUdONgVwAOXVLQyTkdASO4CyiFzhMWbQEj3wbw094oaAtY2hSoaafCloClHwCdIdASgIOWGnQVNAWMeiOUSnPDtCkAh3Dz2MBD/G4BoLOKhgD2AfDo6Zv3v32y89v7929eP3n8AIf3RKMgbghgTQEPn/56hH56OXr/+ll/FhqJoC6AMwU8+RV9o/Ph6SO8ODf1RFAXwDcAnrjGvYMPT3sZB/UhUBeAXyfz+AP6E8HR2z6iIzosqQngugp4g77E8jr/KKhdEdQE4JeJPHiPfhCZHn7EVxVHz3CufKDLgrkAnhz4QA//6as7t653ead+uye/3i4qrt8+qHt4m3sQzIuhuQD8Kg3d///8FT1rc6h+fx3f1tk9mKpfCv79h7s4YybQaW4Buv//uoROdXAIKIrtvUrBdPcazpkHdLomgCUEquR/9Gd0yIBTgFBwoH4vDVy9h7PmoAqDlQD8IomnZdOPfo/emPAIENFAx4Lp7pWcBtDtSgBHCHykWm6b/iVeAcU24qQwcOkmzpwBHQa1AI4qUCXAf6IjZvwCiuKlOubTx+1LP+DU/OhqUAvAj1N4glajG2YoAioD74riBk7ODzoOARwzQNX/t9EJCyQBlYGXRZEtGWAOQADDDMAAQBds0AQUOg7cKopcyQBzAALwwxRIA4AqYBu5YLpTFFcy1USq50oAw36oGgBTdMAKUUCxq477dCi+zpQM1MKQEsBQBakUcKCab4cqoNhTB37aE19fyhIKVS2kBOBHCTxUzd1VrbdDFqCPnJZZJYuBsutcAtQigC8EhgjYwXXBq/K7HMmg7HopgGFHXIVAkbY80AUUd9ShOPZb/mRQ7pWXAvCDBFAFi6zlIUBAgUwgyiFJhmTAKEBdBn1yV4GSEAHX1bE6tfInAy2AYTlc5QC8Vy5CBBSv1ME6srAnA7k8LgUwhADVUhWvnAQJ2FEHz6srZgMyCEgB+DaBx6qhd9BOB0EC9DWBSoUS5mTAJuC1aqivDhaECdCpcG6Wd5GETQCWwgndChOgU+F8CBRXOEOhEsBwKYxdUH4B250hwJoMxCWxEJD+cBDq4E9oootAAYYhwBkK90sB+CYBxMAcAgxDoCi+x99Nh0kAYmAOAcYhwJcMmARgO1Reu/sIFmAcAmzJQApgqwPzCKiGAL4FTMlgJgQc4+sEsCGWR4AeAq0i49KP+ONJHAsBbIUwpRKOEKCHQGetgSMZTIQAfJmCaiGlEo4RoBdIO9fa3+HPp8AiQGfBTAKK2+o13QF2LT0UjkKAXhnZwbdz0pPBOATsqRft4dsa36Qmgy8rDFkQy0H5BGBdwLTekpoMZhwCdCHoXxGMFGCfA4K0ZDBbYbgW1AIovYoTgIUR83pDUjI4WWEoA/ILsOaBkpRkMBmHAOwU2vZdEpLBZIXho0LyCyjUq6yXm/GLJPsr+ILOQzzxMEffGJ5RAF5W3l9p4nd/UU15dP/+3bDhECjg4VvHMwAZBehbRrwcvf1bWG0QJuCZ8xGIjAJwQUTh6I9BGyhBArADaMO7Ny6IFKB3yUjshmTGIAGexyAwH53Ub5YOAHmQhkgW9LwQIkDdBTMCRMFEzgshAt7i/IOnvE2BGAhCBGDpb/iotTlagRgigPwU3KLBGjrplooAAaMJAdVVE+VW4wAB4U8CLozqosG/h0QXoDcAR0FVZ3hvtKUL0Os+o2B+4ewrjOkCIh8GXRDzxSNPYUwW4CmDh0b9nl1nYUwWMJoqSNHYSnTdZEleEBlNEQAa64f2wnifuiQ2oiJA0VpDtwUC8prgiIoA0LrithTGE+Ky+KiKAEX7xm1zYXxC3BgZVREA2tsoxk0k6s7QuIoARXenzlAYz2ibo/Qi4PDwUD/xlYF34vS4YcSPYRehWxgTd4dJHwrx7o6OOzu3XpKbSWX68rYe09f3aI4NO2mdW4uIAvxFwPSgNeVuYfmTh8NWZ3buEAyb7llqF8Y0Ac9wRjsHjdv4FHoBNJ2PhkXkbcJKuXGZulkYCwGEQsBXBHy0LIgHrOa7sNx3sOsVbH6EqV4Yy5uk/LfJPcD5bLwyvP2KXYZQMLXvIXj3i8wNqxXG8jY5fx70FAENz5sbG1v4UuJ/l3xM66Nrq3l2rwHDTTUlVSCQN0r6g4D7c5Gq/m9dOHd6teTM+tf4WfXIQyzz/n+9dgZnX6vO7jNg20+vbjYm3SvsLgJ0qN1cU80Dp8/jrUqcBRj/W+dP4cQlp9Y31c/1c1U2rHftoDAmCXAWAViB3lpH0+acxvuEW7ziQPxrdl9y6rz6jb6L0oL97l1VGJcCfCsCziJAKb6Isd9kTQ2ChIJAXdNuncUJG5xRZ/dsmxrvq1KIQKAemPBcDzqLAGX4QucNUqg26offIignwEXL2U9dlL/1hAFzJlRcvacemfHMAWcRULbwa7SoizJAvruhTanX1n9twO23+aBFiyuUp8acRYCnhaurZ+UB0UNA6t1C7DdxuvTrjoOGC4I5FAHOIqA8u6OFq6tlrIosBsokdg4nMnJOHnELh5uxZkIJBDiLYX0LmBE5vs6jMRZkvopMBHJpewOnsVBmGneilUdY+AUCnLWgazVUzoAtxwSQrIlj9AeCBCJngDG9zDkt++GcA/ZEWBT/gwDnHHDFAJmlPQNADYG4Yki80B5fwQVxkPOay3IlVSL77hXg2hGRIcDzFq2urouDokoBWQQ4I4BERgFXKeDMApUAZxB4YF8PFGPUM0cFcpR6ClYzYvBu4RwORCJwCXAlARkClABPIrReDAkB3hlQzoGohQEhwDsDVBjECwz4kiBJgMgElkEgBBir1CaiiVECXpH0yjyLF7SZvnQUwoKy60qA94OUHvwJN+w1EPPLWQQoRBN38IIgxIVw8wrTSBkEjFiWqSp+KruuBBA+SusGXtYCzXCB67YYCOOrrDWj+G/ZdSXANwckN40flIpmuBiqANVzCKB8nN7dK3hlHTTDxUAFXFY9hwDSFum9a3htDVoMiMVbBiQI+IfqOQRQ5oCgGwhoWSAWYhaIAh3XAogfKfljOxAQmqjWLaIg1AGyFo4BM6ASQH16rh0I/E0sr1ciIVSCenU0FMyASgBxDnQDgediUF0ORuMNMWdwYDDo9lwA/UMlm4HAW6skzICiuICTWImdAaoKElQCyEOgFQg20RIb8Xm6xDPATqml4XDQ6TgBzUDgGQIbOCwSzxD4CocFg07XBYQ8RFwPBO4lIbkakIQzz0ZHAB0C6wJChkAjELiWBLB7kcCmw++p2BQwHwB1AWGfrVsLBPZhir2LJC7iXAaip1cVAhsCwoZAPRDYDHD0377vFJ0B6gOgISDwA8ZrgcDcxjPRI7SJeeclwa6uAiV1AcEfJjEPBJuGWJVwEdRiy3BRdC4husjlcE1dQPhnzNcDQWt5eI3p7VdstASfTcmu9QHQFBD+Gev1iuDieuXg7Fes3Zdsrldl8Znq9og41FIQaAgIDIOS5qXB1oaEJfSZKM+eWFkJ0FlFU0BIMaSxLBYOl3kRJGkKiBgChjWCYdOIAB0BwYlAYlwsHCz1FCBoCYj7ZyOmxcKh0hoAHQFRQ2BMgaA1ADoCYv/bxlgCQe0qQNEREBUHBTfHEQjQyTldAcTHyDrcu4q/MWTKHfEGXQGxQ+D+/e/xVwYMuljDICD+nw79MPRA0CiCFQYBcamwZOCBoJ0CJSYB8ZNg4IEA3WtgFBAbByUDDgTdCCgwCkiYBAMOBKYJYBOQMAmGGwjQtRYWASmTYKCBwDgBrAKSJsEgA4F5AtgFJE2CIQYCdKuDVUDi/2AcWiAwlEAKq4DU/70yrEDwMzrVxS4gMQwMKhDYAoDAISAxDAwpEKBDJlwCkv8V61ACgTUACFwC0qoByTACgaUCUDgFMPwTqgEEAnsAlLgFJAfCAQQCRwCUeAQkB8LFBwJ0xIZPAIOBxQYCdMOKV0DkRkGDBQaC9jZAB6+AqA3TNgsLBM2NUBN+ASwGbn6DFvWLv/8UASwG7n2LNvUJof8kAQzlgOA7tKo/nAWQhiSAx8CNngOBuwDS0ATwGOg3END6TxXAEgd6DQSU+S+hCuAx0F8goPafLoDJQE+BgNz/AAEsNWFPgcBb/80JEMBxXSDoIRCguSSCBDBcHUsyBwLP9W+LMAE86TBvICCmP02ggPRVspKMgYBU/tUIFZC+UlqSLRC41j+NBAsYdCAIm/4lEQKGGwgCp39JjACmacAeCIKHvyRKANM04A0EEcNfEimAKRswBoK/o2GhxApgGgRcgSDy7RfEC+AZBDyBIDT510gQwDMIGAJB/NsvSBLAkw5SA0FU8K9IE8AzD5ICQcLoL0kVEP2ERR3zZzRR6Dz/EEy6gC+z9FBwL24D9XLAwocNBgEsa0URj11xdJ9JAMeCYfBjV/RlPydMAkRCSJ0IQYGA592XsAlIjwX0QMDXfVYBgsSMQAsE6ZG/Dq+A1GBACARMU7+CW4AgZRh4AgHvm1+SQYAYBvHRwBEILnO/+SVZBAjiHZgDQZ7eC3IJEHyOnAvdQPBT2vWOk4wCJFHXSs1AkHq14yGzAMEsXEIVCH5hTPgW8gsoOQlcSr9W/Jxr0rfoSUDJ7Jg0GCbHM7ygD/oUAGazk8mkMyL2J5OTWZ89L/ny5f+yiDXCPYKoAQAAAABJRU5ErkJggg==', + } + + TriggerEvent('esx_phone:addSpecialContact', specialContact.name, specialContact.number, specialContact.base64Icon) + end) + end + + if Config.Blip.show then + CreateThread(function() + local blip = AddBlipForCoord(Config.Zones.ShopEntering.Pos) + + SetBlipSprite (blip, Config.Blip.Sprite) + SetBlipDisplay(blip, Config.Blip.Display) + SetBlipScale (blip, Config.Blip.Scale) + SetBlipAsShortRange(blip, true) + + BeginTextCommandSetBlipName('STRING') + AddTextComponentSubstringPlayerName(_U('car_dealer')) + EndTextCommandSetBlipName(blip) + end) + end + + return true +end + +local function PlayerManagement() + if not Config.EnablePlayerManagement then + return true + end + + if LocalPlayer.state.job ~= 'cardealer' then + Config.Zones.ShopEntering.Type = -1 + Config.Zones.BossActions.Type = -1 + Config.Zones.ResellVehicle.Type = -1 + return true + end + Config.Zones.ShopEntering.Type = 1 + + if LocalPlayer.state.job.grade_name == 'boss' then + Config.Zones.BossActions.Type = 1 + end + return true +end + +local function loadIpl() + RequestIpl('shr_int') + + local interiorID = 7170 + PinInteriorInMemory(interiorID) + ActivateInteriorEntitySet(interiorID, 'csr_beforeMission') + RefreshInterior(interiorID) +end + +RegisterNetEvent('esx:playerLoaded') +AddEventHandler('esx:playerLoaded', function(xPlayer) + Init() + PlayerManagement() + CreateThread(loadIpl) end) RegisterNetEvent('esx:setJob', PlayerManagement) -function DeleteDisplayVehicleInsideShop() +local function DeleteDisplayVehicleInsideShop() local attempt = 0 if currentDisplayVehicle and DoesEntityExist(currentDisplayVehicle) then @@ -77,48 +139,64 @@ function DeleteDisplayVehicleInsideShop() end end -function ReturnVehicleProvider() - ESX.TriggerServerCallback('esx_vehicleshop:getCommercialVehicles', function(vehicles) - local elements = {} - - for k, v in ipairs(vehicles) do - local returnPrice = ESX.Math.Round(v.price * 0.75) - local vehicleLabel = getVehicleFromModel(v.vehicle).name +local function ReturnVehicleProvider() + local elements = { + { + unselectable = true, + icon = "fas fa-car", + title = _U('car_dealer'), + }, + } + + for k, v in ipairs(cardealerVehicles) do + local returnPrice = ESX.Math.Round(v.price * 0.75) + local vehicleLabel = getVehicleFromModel(v.vehicle).label + + TableInsert(elements, { + title = ('%s [%s]'):format(vehicleLabel, _U('generic_shopitem', ESX.Math.GroupDigits(returnPrice))), + name = v.vehicle + }) + end - table.insert(elements, { - label = ('%s [%s]'):format(vehicleLabel, _U('generic_shopitem', ESX.Math.GroupDigits(returnPrice))), - value = v.vehicle - }) - end + ESX.OpenContext("right", elements, function(menu, element) + if not element.name then return ESX.CloseContext() end + TriggerServerEvent('esx_vehicleshop:returnProvider', element.name) + Wait(500) + ESX.CloseContext() + ReturnVehicleProvider() + end, function(menu) + end) +end - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'return_provider_menu', { - title = _U('return_provider_menu'), - align = 'top-left', - elements = elements - }, function(data, menu) - TriggerServerEvent('esx_vehicleshop:returnProvider', data.current.value) +local function StartShopRestriction() + while IsInShopMenu do + Wait(0) - Wait(300) - menu.close() - ReturnVehicleProvider() - end, function(data, menu) - menu.close() - end) - end) + DisableControlAction(0, 75, true) -- Disable exit vehicle + DisableControlAction(27, 75, true) -- Disable exit vehicle + end end -function StartShopRestriction() - CreateThread(function() - while IsInShopMenu do - Wait(0) +local function WaitForVehicleToLoad(modelHash) + modelHash = (type(modelHash) == 'number' and modelHash or joaat(modelHash)) + + if not HasModelLoaded(modelHash) then + RequestModel(modelHash) - DisableControlAction(0, 75, true) -- Disable exit vehicle - DisableControlAction(27, 75, true) -- Disable exit vehicle + BeginTextCommandBusyspinnerOn('STRING') + AddTextComponentSubstringPlayerName(_U('shop_awaiting_model')) + EndTextCommandBusyspinnerOn(4) + + while not HasModelLoaded(modelHash) do + Wait(0) + DisableAllControlActions(0) end - end) + + BusyspinnerOff() + end end -function OpenShopMenu() +local function OpenShopMenu() if #Vehicles == 0 then print('[^3ERROR^7] Vehicleshop has ^50^7 vehicles, please add some!') return @@ -126,10 +204,11 @@ function OpenShopMenu() IsInShopMenu = true - StartShopRestriction() + CreateThread(StartShopRestriction) ESX.UI.Menu.CloseAll() + ESX.CloseContext() - local playerPed = PlayerPedId() + local playerPed = ESX.PlayerData.ped FreezeEntityPosition(playerPed, true) SetEntityVisible(playerPed, false) @@ -150,12 +229,12 @@ function OpenShopMenu() firstVehicleData = vehicle end - table.insert(options, ('%s %s'):format(vehicle.name, _U('generic_shopitem', ESX.Math.GroupDigits(vehicle.price)))) + TableInsert(options, ('%s %s'):format(vehicle.name, _U('generic_shopitem', ESX.Math.GroupDigits(vehicle.price)))) end table.sort(options) - table.insert(elements, { + TableInsert(elements, { name = category.name, label = category.label, value = 0, @@ -190,7 +269,7 @@ function OpenShopMenu() CurrentActionMsg = _U('shop_menu') CurrentActionData = {} - local playerPed = PlayerPedId() + local playerPed = ESX.PlayerData.ped FreezeEntityPosition(playerPed, false) SetEntityVisible(playerPed, true) SetEntityCoords(playerPed, Config.Zones.ShopEntering.Pos) @@ -227,7 +306,7 @@ function OpenShopMenu() end, function(data, menu) menu.close() DeleteDisplayVehicleInsideShop() - local playerPed = PlayerPedId() + local playerPed = ESX.PlayerData.ped CurrentAction = 'shop_menu' CurrentActionMsg = _U('shop_menu') @@ -240,7 +319,7 @@ function OpenShopMenu() IsInShopMenu = false end, function(data, menu) local vehicleData = vehiclesByCategory[data.current.name][data.current.value + 1] - local playerPed = PlayerPedId() + local playerPed = ESX.PlayerData.ped DeleteDisplayVehicleInsideShop() WaitForVehicleToLoad(vehicleData.model) @@ -264,47 +343,35 @@ function OpenShopMenu() end) end -function WaitForVehicleToLoad(modelHash) - modelHash = (type(modelHash) == 'number' and modelHash or joaat(modelHash)) - - if not HasModelLoaded(modelHash) then - RequestModel(modelHash) - - BeginTextCommandBusyspinnerOn('STRING') - AddTextComponentSubstringPlayerName(_U('shop_awaiting_model')) - EndTextCommandBusyspinnerOn(4) - - while not HasModelLoaded(modelHash) do - Wait(0) - DisableAllControlActions(0) - end - - BusyspinnerOff() - end -end - function OpenResellerMenu() ESX.UI.Menu.CloseAll() - - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'reseller', { - title = _U('car_dealer'), - align = 'top-left', - elements = { - {label = _U('buy_vehicle'), value = 'buy_vehicle'}, - {label = _U('pop_vehicle'), value = 'pop_vehicle'}, - {label = _U('depop_vehicle'), value = 'depop_vehicle'}, - {label = _U('return_provider'), value = 'return_provider'}, - {label = _U('create_bill'), value = 'create_bill'}, - {label = _U('get_rented_vehicles'), value = 'get_rented_vehicles'}, - {label = _U('set_vehicle_owner_sell'), value = 'set_vehicle_owner_sell'}, - {label = _U('set_vehicle_owner_rent'), value = 'set_vehicle_owner_rent'} - }}, function(data, menu) - local action = data.current.value + ESX.CloseContext() + + local elements = { + {unselectable = true, icon = 'fas fa-car', title = _U('car_dealer')}, + {title = _U('buy_vehicle'), name = 'buy_vehicle'}, + {title = _U('pop_vehicle'), name = 'pop_vehicle'}, + {title = _U('depop_vehicle'), name = 'depop_vehicle'}, + {title = _U('return_provider'), name = 'return_provider'}, + {title = _U('create_bill'), name = 'create_bill'}, + {title = _U('get_rented_vehicles'), name = 'get_rented_vehicles'}, + {title = _U('set_vehicle_owner_sell'), name = 'set_vehicle_owner_sell'}, + {title = _U('set_vehicle_owner_rent'), name = 'set_vehicle_owner_rent'}, + {title = _U('deposit_stock'), name = 'put_stock'}, + {title = _U('take_stock'), name = 'get_stock'}, + } + + ESX.OpenContext('right', elements, function(menu, element) + local action = element.name if Config.OxInventory and (action == 'put_stock' or action == 'get_stock') then exports.ox_inventory:openInventory('stash', 'society_cardealer') elseif action == 'buy_vehicle' then OpenShopMenu() + elseif action == 'put_stock' then + OpenPutStocksMenu() + elseif action == 'get_stock' then + OpenGetStocksMenu() elseif action == 'pop_vehicle' then OpenPopVehicleMenu() elseif action == 'depop_vehicle' then @@ -317,28 +384,22 @@ function OpenResellerMenu() ReturnVehicleProvider() elseif action == 'create_bill' then local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer ~= -1 and closestDistance < 3 then - ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'set_vehicle_owner_sell_amount', { - title = _U('invoice_amount') - }, function(data2, menu2) - local amount = tonumber(data2.value) - - if amount == nil then - ESX.ShowNotification(_U('invalid_amount')) - else - menu2.close() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('no_players')) - else - TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_cardealer', _U('car_dealer'), tonumber(data2.value)) + ESX.CloseContext() + ESX.OpenContext('right', {{title = _U('invoice_amount'), input = true, inputType = 'number', inputValue = 0, inputMin = 0, name = 'invoice_amount'}}, function(menu2, element2) + if element2.name == 'invoice_amount' then + local amount = tonumber(element2.inputValue) + if amount ~= nil then + ESX.CloseContext() + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_cardealer', _U('car_dealer'), amount) + end end end - end, function(data2, menu2) - menu2.close() - end) + end, function(menu) end) else ESX.ShowNotification(_U('no_players')) end @@ -397,9 +458,7 @@ function OpenResellerMenu() ESX.ShowNotification(_U('no_current_vehicle')) end end - end, function(data, menu) - menu.close() - + end, function(menu) CurrentAction = 'reseller_menu' CurrentActionMsg = _U('shop_menu') CurrentActionData = {} @@ -407,66 +466,62 @@ function OpenResellerMenu() end function OpenPopVehicleMenu() - ESX.TriggerServerCallback('esx_vehicleshop:getCommercialVehicles', function(vehicles) - local elements = {} + local elements = {} - for k,v in ipairs(vehicles) do - local vehicleLabel = getVehicleFromModel(v.vehicle).name + for k,v in ipairs(cardealerVehicles) do + local vehicleLabel = getVehicleFromModel(v.vehicle).label - table.insert(elements, { - label = ('%s [%s]'):format(vehicleLabel, _U('generic_shopitem', ESX.Math.GroupDigits(v.price))), - value = v.vehicle - }) - end + TableInsert(elements, { + label = ('%s [%s]'):format(vehicleLabel, _U('generic_shopitem', ESX.Math.GroupDigits(v.price))), + value = v.vehicle + }) + end - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'commercial_vehicles', { - title = _U('vehicle_dealer'), - align = 'top-left', - elements = elements - }, function(data, menu) - local model = data.current.value - DeleteDisplayVehicleInsideShop() + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'commercial_vehicles', { + title = _U('vehicle_dealer'), + align = 'top-left', + elements = elements + }, function(data, menu) + local model = data.current.value + DeleteDisplayVehicleInsideShop() - ESX.Game.SpawnVehicle(model, Config.Zones.ShopInside.Pos, Config.Zones.ShopInside.Heading, function(vehicle) - currentDisplayVehicle = vehicle + ESX.Game.SpawnVehicle(model, Config.Zones.ShopInside.Pos, Config.Zones.ShopInside.Heading, function(vehicle) + currentDisplayVehicle = vehicle - for i=1, #Vehicles, 1 do - if model == Vehicles[i].model then - CurrentVehicleData = Vehicles[i] - break - end + for i=1, #Vehicles, 1 do + if model == Vehicles[i].model then + CurrentVehicleData = Vehicles[i] + break end - end) - end, function(data, menu) - menu.close() + end end) + end, function(data, menu) + menu.close() end) end function OpenRentedVehiclesMenu() - ESX.TriggerServerCallback('esx_vehicleshop:getRentedVehicles', function(vehicles) - local elements = {} + local elements = {} - for k,v in ipairs(vehicles) do - local vehicleLabel = getVehicleFromModel(v.name).label + for k,v in ipairs(rentedVehicles) do + local vehicleLabel = getVehicleFromModel(v.name).label - table.insert(elements, { - label = ('%s: %s - %s'):format(v.playerName, vehicleLabel, v.plate), - value = v.name - }) - end + TableInsert(elements, { + label = ('%s: %s - %s'):format(v.playerName, vehicleLabel, v.plate), + value = v.name + }) + end - ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'rented_vehicles', { - title = _U('rent_vehicle'), - align = 'top-left', - elements = elements - }, nil, function(data, menu) - menu.close() - end) + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'rented_vehicles', { + title = _U('rent_vehicle'), + align = 'top-left', + elements = elements + }, nil, function(data, menu) + menu.close() end) end -function OpenBossActionsMenu() +local function OpenBossActionsMenu() ESX.UI.Menu.CloseAll() ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'reseller',{ @@ -482,21 +537,20 @@ function OpenBossActionsMenu() end) elseif data.current.value == 'sold_vehicles' then - ESX.TriggerServerCallback('esx_vehicleshop:getSoldVehicles', function(customers) local elements = { head = { _U('customer_client'), _U('customer_model'), _U('customer_plate'), _U('customer_soldby'), _U('customer_date') }, rows = {} } - for i=1, #customers, 1 do - table.insert(elements.rows, { - data = customers[i], + for i=1, #soldVehicles, 1 do + TableInsert(elements.rows, { + data = soldVehicles[i], cols = { - customers[i].client, - customers[i].model, - customers[i].plate, - customers[i].soldby, - customers[i].date + soldVehicles[i].client, + soldVehicles[i].model, + soldVehicles[i].plate, + soldVehicles[i].soldby, + soldVehicles[i].date } }) end @@ -506,7 +560,6 @@ function OpenBossActionsMenu() end, function(data2, menu2) menu2.close() end) - end) end end, function(data, menu) @@ -518,20 +571,107 @@ function OpenBossActionsMenu() end) end -function hasEnteredMarker(zone) +function OpenGetStocksMenu() + ESX.TriggerServerCallback('esx_vehicleshop:getStockItems', function(items) + local elements = {} + + for i=1, #items, 1 do + if items[i].count > 0 then + TableInsert(elements, { + label = 'x' .. items[i].count .. ' ' .. items[i].label, + value = items[i].name + }) + end + end + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', { + title = _U('dealership_stock'), + align = 'top-left', + elements = elements + }, function(data, menu) + local itemName = data.current.value + + ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', { + title = _U('amount') + }, function(data2, menu2) + local count = tonumber(data2.value) + + if count == nil then + ESX.ShowNotification(_U('quantity_invalid')) + else + TriggerServerEvent('esx_vehicleshop:getStockItem', itemName, count) + menu2.close() + menu.close() + OpenGetStocksMenu() + end + end, function(data2, menu2) + menu2.close() + end) + end, function(data, menu) + menu.close() + end) + end) +end + +function OpenPutStocksMenu() + ESX.TriggerServerCallback('esx_vehicleshop:getPlayerInventory', function(inventory) + local elements = {} + + for i=1, #inventory.items, 1 do + local item = inventory.items[i] + + if item.count > 0 then + TableInsert(elements, { + label = item.label .. ' x' .. item.count, + type = 'item_standard', + value = item.name + }) + end + end + + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', { + title = _U('inventory'), + align = 'top-left', + elements = elements + }, function(data, menu) + local itemName = data.current.value + + ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', { + title = _U('amount') + }, function(data2, menu2) + local count = tonumber(data2.value) + + if count == nil then + ESX.ShowNotification(_U('quantity_invalid')) + else + TriggerServerEvent('esx_vehicleshop:putStockItems', itemName, count) + menu2.close() + menu.close() + OpenPutStocksMenu() + end + end, function(data2, menu2) + menu2.close() + end) + end, function(data, menu) + menu.close() + end) + end) +end + +local function hasEnteredMarker(zone) if zone == 'ShopEntering' then if not Config.EnablePlayerManagement then CurrentAction = 'shop_menu' CurrentActionMsg = _U('shop_menu') CurrentActionData = {} end - if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'cardealer' then + if LocalPlayer.state.job ~= nil and LocalPlayer.state.job.name == 'cardealer' then CurrentAction = 'reseller_menu' CurrentActionMsg = _U('shop_menu') CurrentActionData = {} end elseif zone == 'GiveBackVehicle' and Config.EnablePlayerManagement then - local playerPed = PlayerPedId() + local playerPed = ESX.PlayerData.ped if IsPedInAnyVehicle(playerPed, false) then local vehicle = GetVehiclePedIsIn(playerPed, false) @@ -541,7 +681,7 @@ function hasEnteredMarker(zone) CurrentActionData = {vehicle = vehicle} end elseif zone == 'ResellVehicle' then - local playerPed = PlayerPedId() + local playerPed = ESX.PlayerData.ped if IsPedSittingInAnyVehicle(playerPed) then local vehicle = GetVehiclePedIsIn(playerPed, false) @@ -576,58 +716,44 @@ function hasEnteredMarker(zone) end end - elseif zone == 'BossActions' and Config.EnablePlayerManagement and ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == 'cardealer' and ESX.PlayerData.job.grade_name == 'boss' then + elseif zone == 'BossActions' and Config.EnablePlayerManagement and LocalPlayer.state.job ~= nil and LocalPlayer.state.job.name == 'cardealer' and LocalPlayer.state.job.grade_name == 'boss' then CurrentAction = 'boss_actions_menu' CurrentActionMsg = _U('shop_menu') CurrentActionData = {} end end -function hasExitedMarker(zone) +local function hasExitedMarker(zone) if not IsInShopMenu then ESX.UI.Menu.CloseAll() + ESX.CloseContext() end ESX.HideUI() CurrentAction = nil end AddEventHandler('onResourceStop', function(resource) - if resource == GetCurrentResourceName() then - if IsInShopMenu then - ESX.UI.Menu.CloseAll() - - local playerPed = PlayerPedId() + if resource ~= GetCurrentResourceName() then return end + if IsInShopMenu then + ESX.UI.Menu.CloseAll() + ESX.CloseContext() - FreezeEntityPosition(playerPed, false) - SetEntityVisible(playerPed, true) - SetEntityCoords(playerPed, Config.Zones.ShopEntering.Pos) - end + local playerPed = ESX.PlayerData.ped - DeleteDisplayVehicleInsideShop() + FreezeEntityPosition(playerPed, false) + SetEntityVisible(playerPed, true) + SetEntityCoords(playerPed, Config.Zones.ShopEntering.Pos) end -end) --- Create Blips -if Config.Blip.show then - CreateThread(function() - local blip = AddBlipForCoord(Config.Zones.ShopEntering.Pos) - - SetBlipSprite (blip, Config.Blip.Sprite) - SetBlipDisplay(blip, Config.Blip.Display) - SetBlipScale (blip, Config.Blip.Scale) - SetBlipAsShortRange(blip, true) - - BeginTextCommandSetBlipName('STRING') - AddTextComponentSubstringPlayerName(_U('car_dealer')) - EndTextCommandSetBlipName(blip) - end) -end + ESX.HideUI() + DeleteDisplayVehicleInsideShop() +end) -- Enter / Exit marker events & Draw Markers CreateThread(function() while true do Wait(0) - local playerCoords = GetEntityCoords(PlayerPedId()) + local playerCoords = GetEntityCoords(ESX.PlayerData.ped) local isInMarker, letSleep, currentZone = false, true for k,v in pairs(Config.Zones) do @@ -658,7 +784,7 @@ CreateThread(function() end if letSleep then - Wait(500) + Wait(1000) end end end) @@ -711,18 +837,9 @@ CreateThread(function() CurrentAction = nil end else - Wait(500) + Wait(1000) end end end) -CreateThread(function() - RequestIpl('shr_int') -- Load walls and floor - - local interiorID = 7170 - PinInteriorInMemory(interiorID) - ActivateInteriorEntitySet(interiorID, 'csr_beforeMission') -- Load large window - RefreshInterior(interiorID) -end) - if ESX.PlayerLoaded then PlayerManagement() end \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/client/utils.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/client/utils.lua index c47811c1f..1e4f30f88 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/client/utils.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/client/utils.lua @@ -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 @@ -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 @@ -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) @@ -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 \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/config.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/config.lua index 7d62c1ccd..412135f7c 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/config.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/config.lua @@ -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 diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/fxmanifest.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/fxmanifest.lua index 7aa97a71b..23cfcb761 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/fxmanifest.lua @@ -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' @@ -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' \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/br.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/br.lua deleted file mode 100644 index 240b7c147..000000000 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/br.lua +++ /dev/null @@ -1,61 +0,0 @@ -Locales['br'] = { - -- global menus - ['not_enough_in_society'] = 'não há o suficiente desse ~r~that item na sociedade!', - ['player_cannot_hold'] = 'você não tem espaço suficiente em seu inventário!', - ['vehicle_belongs'] = 'um veículo com placa %s agora pertence a you', - ['broke_company'] = 'você não tem dinheiro suficiente na conta da empresa', - ['license_missing'] = 'você não tem carteira de motorista!', - ['buy_vehicle_shop'] = 'comprar %s por $%s?', - ['buy_vehicle'] = 'comprar veículo', - ['car_dealer'] = 'Concessionária de carros', - ['shop_awaiting_model'] = 'o veículo está carregando no momento, aguarde', - ['create_bill'] = 'criar recibo', - ['dealer_boss'] = 'Concessionária de carros - Chefe', - ['delivered'] = 'veículo entregue para o revendedor', - ['depop_vehicle'] = 'volte ao veiculo', - ['return_provider'] = 'devolver veículo ao fornecedor', - ['get_rented_vehicles'] = 'veículos para alugar', - ['no_current_vehicle'] = 'you do not currently have an vehicle displayed', - ['invalid_amount'] = 'Montante inválido', - ['invoice_amount'] = 'valor da fatura', - ['no'] = 'não', - ['yes'] = 'sim', - ['no_players'] = 'sem jogadores nas proximidades', - ['not_enough_money'] = 'você não tem dinheiro suficiente', - ['not_rental'] = 'isso não é um ~r~veículo de aluguel', - ['not_yours'] = 'este veículo não pertence a você', - ['paid_rental'] = 'you have paid $%s for renting an vehicle with plate %s', - ['paid_rental_evicted'] = 'you could not afford to pay $%s for your rented vehicle with plate %s, it has been returned to the dealership', - ['pop_vehicle'] = 'sai do veiculo', - ['rent_vehicle'] = 'Concessionária - Veículos para alugar', - ['return_provider_menu'] = 'revendedor de carros - Devolver veículo ao fornecedor', - ['rental_amount'] = 'montante do aluguel', - ['sell_menu'] = 'Pressione [E] para vender ', - ['set_vehicle_owner_rent'] = 'Atribuir veículo [Alugar]', - ['set_vehicle_owner_sell'] = 'Veículos para [Venda]', - ['shop_menu'] = 'pressione [E] para acessar o menu', - ['generic_shopitem'] = '$%s', - ['vehicle_dealer'] = 'Veículo - Concessionária', - ['vehicle_menu'] = 'Pressione [E] para fazer o seu veículo', - ['vehicle_purchased'] = 'você comprou um veículo', - ['vehicle_set_owned'] = 'Veículo %s foi atribuído a %s', - ['vehicle_set_rented'] = 'Veículo %s foi alugado para %s', - ['vehicle_sold_for'] = 'o %s foi vendido com sucesso para $%s', - ['vehicle_sold_to'] = 'Veículo %s vendido para %s', - ['dealership_stock'] = 'estoque da concessionária', - ['amount'] = 'montante', - ['quantity_invalid'] = 'quantidade inválida', - ['inventory'] = 'Inventário', - ['dealership'] = 'Concessionária', - ['have_withdrawn'] = 'você retirou x%s %s', - ['have_deposited'] = 'você depositou x%s %s', - ['boss_actions'] = 'ações do chefe', - ['invalid_vehicle'] = 'Veículo inválido', - -- sold vehicles - ['boss_sold'] = 'lista de veículos vendidos', - ['customer_client'] = 'nome do cliente', - ['customer_model'] = 'modelo de carro', - ['customer_plate'] = 'placa do carro', - ['customer_soldby'] = 'vendido por', - ['customer_date'] = 'data', -} diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/cs.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/cs.lua index 6f59b098d..bc14c3dd5 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/cs.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/cs.lua @@ -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', diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/da.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/da.lua new file mode 100644 index 000000000..3963afc13 --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/da.lua @@ -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', +} diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/de.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/de.lua new file mode 100644 index 000000000..76fa1460a --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/de.lua @@ -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', +} diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/en.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/en.lua index 595f46257..3511ec358 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/en.lua @@ -42,11 +42,14 @@ Locales['en'] = { ['vehicle_set_rented'] = 'vehicle %s has been rented to %s', ['vehicle_sold_for'] = 'the %s has been sold for $%s', ['vehicle_sold_to'] = 'the vehicle with plate %s has been sold to %s', + ['deposit_stock'] = 'deposit stock', + ['take_stock'] = 'withdraw stock', ['dealership_stock'] = 'dealership Stock', ['amount'] = 'amount', ['quantity_invalid'] = 'that\'s an invalid quantity', ['inventory'] = 'inventory', ['dealership'] = 'car Dealer', + ['dealer_customers'] = 'dealer customers', ['have_withdrawn'] = 'you have withdrawn x%s %s', ['have_deposited'] = 'you have deposited x%s %s', ['boss_actions'] = 'boss actions', diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/es.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/es.lua index f0595a5e9..294118342 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/es.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/es.lua @@ -42,11 +42,14 @@ Locales['es'] = { ['vehicle_set_rented'] = 'el vehiculo %s fue rentado a %s', ['vehicle_sold_for'] = 'el %s fue vendido por $%s', ['vehicle_sold_to'] = 'el vehiculo con matricula %s fue vendido por %s', + ['deposit_stock'] = 'Depositar stock', + ['take_stock'] = 'Retirar stock', ['dealership_stock'] = 'Stock de vendedor', ['amount'] = 'Cantidad', ['quantity_invalid'] = 'Cantidad invalida', ['inventory'] = 'Inventario', ['dealership'] = 'Vendedor de autos', + ['dealer_customers'] = 'Clientes del vendedor', ['have_withdrawn'] = 'Has retirado x%s %s', ['have_deposited'] = 'Has depositado x%s %s', ['boss_actions'] = 'Acciones de jefe', diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/fi.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/fi.lua index c84e64dcd..2c0774465 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/fi.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/fi.lua @@ -1,62 +1,65 @@ Locales['fi'] = { -- global menus - ['not_enough_in_society'] = 'firman varastossa ei ole enempää ~r~tuota esinettä!', - ['player_cannot_hold'] = 'sinulla ~r~ei ole tarpeeksi vapaata tilaa repussasi!', - ['vehicle_belongs'] = 'ajoneuvo kilvellä %s on nyt sinun omistuksessasi', - ['broke_company'] = 'sinulla ei ole tarpeeksi rahaa yrityksen tilillä', - ['license_missing'] = 'you don\'t have a driver\'s license!', - ['buy_vehicle_shop'] = 'haluatko ostaa ajoneuvon %s hintaan $%s?', - ['buy_vehicle'] = 'osta ajoneuvo', - ['car_dealer'] = 'autokauppa', - ['shop_awaiting_model'] = 'the vehicle is currently loading, please wait', - ['create_bill'] = 'tee lasku', - ['dealer_boss'] = 'autokauppa - Pomo', - ['delivered'] = 'ajoneuvo on kuljetettu myyjälle', - ['depop_vehicle'] = 'palauta ajoneuvo', - ['return_provider'] = 'return vehicle to provider', - ['get_rented_vehicles'] = 'vuokrattavat ajoneuvot', - ['no_current_vehicle'] = 'you do not currently have an vehicle displayed', - ['invalid_amount'] = 'virheellinen summa', - ['invoice_amount'] = 'laskun summa', - ['no'] = 'ei', - ['yes'] = 'kyllä', - ['no_players'] = 'ei pelaajia lähettyvillä', - ['not_enough_money'] = 'sinulla ei ole tarpeeksi rahaa', - ['not_rental'] = 'tämä ei ole ~r~vuokra ajoneuvo', - ['not_yours'] = 'tämä ajoneuvo ei kuulu sinulle', - ['paid_rental'] = 'you have paid $%s for renting an vehicle with plate %s', - ['paid_rental_evicted'] = 'you could not afford to pay $%s for your rented vehicle with plate %s, it has been returned to the dealership', - ['pop_vehicle'] = 'ota ajoneuvo ulos näkyville myyntiä varten', - ['rent_vehicle'] = 'autokauppa - Vuokrattavat ajokit', - ['return_provider_menu'] = 'car Dealer - Return vehicle to provider', - ['rental_amount'] = 'vuokran summa', - ['sell_menu'] = 'paina [E] myydäksesi %s hintaan: $%s', - ['set_vehicle_owner_rent'] = 'määritä ajoneuvon [Vuokra]', - ['set_vehicle_owner_sell'] = 'myy ajoneuvo', - ['shop_menu'] = 'paina [E] avataksesi menu', + ['not_enough_in_society'] = 'Firmalla ei ole enempää tätä esinettä varastossa!', + ['player_cannot_hold'] = 'Sinulla ei ole tarpeeksi vapaata tilaa repussasi!', + ['vehicle_belongs'] = 'Ajoneuvo kilvellä %s on nyt sinun omistuksessasi', + ['broke_company'] = 'Firman tilillä ei ole tarpeeksi rahaa', + ['license_missing'] = 'Sinulla ei ole ajokorttia!', + ['buy_vehicle_shop'] = 'Haluatko ostaa ajoneuvon %s hintaan $%s?', + ['buy_vehicle'] = 'Osta ajoneuvo', + ['car_dealer'] = 'Ajoneuvoliike', + ['shop_awaiting_model'] = 'Ajoneuvo ladataan, odota hetki', + ['create_bill'] = 'Kirjoita lasku', + ['dealer_boss'] = 'Ajoneuvoliike - Pomo', + ['delivered'] = 'Ajoneuvo on kuljetettu myyjälle', + ['depop_vehicle'] = 'Palauta ajoneuvo', + ['return_provider'] = 'Palauta ajoneuvo palveluntarjoajalle', + ['get_rented_vehicles'] = 'Vuokrattavat ajoneuvot', + ['no_current_vehicle'] = 'Sinulla ei ole tällä hetkellä mitään ajoneuvoa näytöllä', + ['invalid_amount'] = 'Virheellinen summa', + ['invoice_amount'] = 'Laskun summa', + ['no'] = 'Ei', + ['yes'] = 'Kyllä', + ['no_players'] = 'Ei pelaajia lähettyvillä', + ['not_enough_money'] = 'Sinulla ei ole tarpeeksi rahaa', + ['not_rental'] = 'Tämä ei ole vuokra ajoneuvo', + ['not_yours'] = 'Tämä ajoneuvo ei kuulu sinulle', + ['paid_rental'] = 'Olet maksanut $%s vuokrasta ajoneuvolle, jonka kilpi on %s', + ['paid_rental_evicted'] = 'Et voinut maksaa $%s vuokraa ajoneuvosta, jonka kilpi on %s. Se on palautettu ajoneuvoliikeeseen', + ['pop_vehicle'] = 'Ota ajoneuvo ulos näkyville', + ['rent_vehicle'] = 'Ajoneuvoliike - Vuokrattavat ajoneuvot', + ['return_provider_menu'] = 'Ajoneuvoliike - Palauta ajoneuvo palveluntarjoajalle', + ['rental_amount'] = 'Vuokran summa', + ['sell_menu'] = 'Paina [E] myydäksesi %s hintaan: $%s', + ['set_vehicle_owner_rent'] = 'Määritä ajoneuvon vuokra', + ['set_vehicle_owner_sell'] = 'Myy ajoneuvo', + ['shop_menu'] = 'Paina [E] avataksesi valikko', ['generic_shopitem'] = '$%s', - ['vehicle_dealer'] = 'ajonevuo - Autokauppa', - ['vehicle_menu'] = 'paina [E] tehdäksesi tästä sinun ajoneuvo', - ['vehicle_purchased'] = 'sinä ostit ajoneuvon', - ['vehicle_set_owned'] = 'ajoneuvo %s on nyt määritetty henkilölle %s', - ['vehicle_set_rented'] = 'ajoneuvo %s on nyt vuokrattu henkilölle %s', - ['vehicle_sold_for'] = 'the %s has been sold for $%s', - ['vehicle_sold_to'] = 'ajoneuvo %s myyty henkilölle %s', - ['dealership_stock'] = 'autokaupan varasto', - ['amount'] = 'määrä', - ['quantity_invalid'] = 'virheellinen määrä', - ['inventory'] = 'reppu', - ['dealership'] = 'autokauppa', - ['have_withdrawn'] = 'sinä otit x%s %s', - ['have_deposited'] = 'sinä talletit x%s %s', + ['vehicle_dealer'] = 'Ajoneuvo - Ajoneuvoliike', + ['vehicle_menu'] = 'Paina [E] tehdäksesi tästä sinun ajoneuvo', + ['vehicle_purchased'] = 'Sinä ostit ajoneuvon', + ['vehicle_set_owned'] = 'Ajoneuvo %s on nyt määritetty henkilölle %s', + ['vehicle_set_rented'] = 'Ajoneuvo %s on nyt vuokrattu henkilölle %s', + ['vehicle_sold_for'] = '%s on myyty hintaan $%s', + ['vehicle_sold_to'] = 'Ajoneuvo %s myyty henkilölle %s', + ['deposit_stock'] = 'Laita varastoon', + ['take_stock'] = 'Ota varastosta', + ['dealership_stock'] = 'Ajoneuvoliikeen varasto', + ['amount'] = 'Määrä', + ['quantity_invalid'] = 'Virheellinen määrä', + ['inventory'] = 'Reppu', + ['dealership'] = 'Ajoneuvoliike', + ['dealer_customers'] = 'Ajoneuvoliikeen asiakas', + ['have_withdrawn'] = 'Sinä nostit x%s %s', + ['have_deposited'] = 'Sinä talletit x%s %s', ['boss_actions'] = 'Pomo toiminnot', - ['invalid_vehicle'] = 'di-wastong sasakyan', + ['invalid_vehicle'] = 'Virheellinen ajoneuvo', -- sold vehicles - ['boss_sold'] = 'list of sold vehicles', - ['customer_client'] = 'customer name', - ['customer_model'] = 'car model', - ['customer_plate'] = 'car plate', - ['customer_soldby'] = 'sold by', - ['customer_date'] = 'date', + ['boss_sold'] = 'Lista myydyistä ajoneuvoista', + ['customer_client'] = 'Asiakaan nimi', + ['customer_model'] = 'Ajoneuvon malli', + ['customer_plate'] = 'Ajoneuvon kilpi', + ['customer_soldby'] = 'Myynyt', + ['customer_date'] = 'Päiväys', } diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/fr.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/fr.lua index 327c990fa..3837c4de1 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/fr.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/fr.lua @@ -42,11 +42,14 @@ Locales['fr'] = { ['vehicle_set_rented'] = 'le véhicule %s a été loué à %s', ['vehicle_sold_for'] = 'le %s a été vendu pour $%s', ['vehicle_sold_to'] = 'véhicule %s vendu à %s', + ['deposit_stock'] = 'déposer Stock', + ['take_stock'] = 'prendre Stock', ['dealership_stock'] = 'concession Stock', ['amount'] = 'quantité', ['quantity_invalid'] = 'quantité invalide', ['inventory'] = 'inventaire', ['dealership'] = 'concession', + ['dealer_customers'] = 'client concession', ['have_withdrawn'] = 'vous avez retiré x%s %s', ['have_deposited'] = 'vous avez deposé x%s %s', ['boss_actions'] = 'actions du chef', diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/hu.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/hu.lua index ce74eb2a6..bd681b3aa 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/hu.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/hu.lua @@ -2,13 +2,13 @@ Locales['hu'] = { -- global menus ['not_enough_in_society'] = 'nincs elég ~r~tárgyad a vállalkozásban!', ['player_cannot_hold'] = '~r~nincs elég helyed a leltárban!', - ['vehicle_belongs'] = 'egy jármü engedélyel %s most már hozzád tartozik', + ['vehicle_belongs'] = '%s rendszámú jármű már a tulajdonodban van.', ['broke_company'] = 'nincs elég pénz a vállalati számlán', ['license_missing'] = 'nincs jogosítványod tedd le!', ['purchase_type'] = 'a vásárlás típusa', ['society_type'] = 'vállalkozás', ['staff_type'] = 'személyes használat', - ['buy_vehicle_shop'] = 'meg szeretnéd vásárolni %s ennyiért: %s NP-ért?', + ['buy_vehicle_shop'] = 'meg szeretnéd vásárolni %s ennyiért: %s $-ért?', ['buy_vehicle'] = 'vásárlás', ['car_dealer'] = 'Autókereskedés', ['shop_awaiting_model'] = 'az autó töltése folyamantban kérlek várj', @@ -26,32 +26,36 @@ Locales['hu'] = { ['not_enough_money'] = 'nincs elég pénzed', ['not_rental'] = 'ez nem ~r~bérelhetö autó', ['not_yours'] = 'ez az autó nem tartozik hozzád', - ['paid_rental'] = 'fizettél a kölcsönzönek: %s NP', + ['paid_rental'] = 'fizettél a kölcsönzönek: %s $', ['pop_vehicle'] = 'tedd a jármüvet eladásra', ['rent_vehicle'] = 'Autókereskedö - Jármüvek bérlése', ['return_provider_menu'] = 'Autókereskedö - Jámrü vissza adás a szollgáltatónak', ['rental_amount'] = 'bérlési költség', - ['sell_menu'] = 'nyomj [E] gombot hogy eladd a %s ennyiért %s NP', + ['sell_menu'] = 'nyomj [E] gombot hogy eladd a %s ennyiért %s $', ['set_vehicle_owner_rent'] = 'jármü kijelölése [Location]', ['set_vehicle_owner_sell'] = 'jármü eladása', ['set_vehicle_owner_sell_society'] = 'jármü kijelölése [Sale] [Society]', ['shop_menu'] = 'nyomj [E] gombot a vásárláshoz', - ['generic_shopitem'] = '%s NP', + ['generic_shopitem'] = '%s $', ['vehicle_dealer'] = 'jármü - Autókereskedö', ['vehicle_menu'] = 'nyomj [E] gombot hogy vissza add a bérelt jármüvet', ['vehicle_purchased'] = 'vásároltál egy jármüvet', ['vehicle_set_owned'] = 'jármü %s megvéve ennyiért: %s', ['vehicle_set_rented'] = 'jármü %s kibérelve ennyiért: %s', - ['vehicle_sold_for'] = 'A %s jármü eladva ennyiért %s NP', + ['vehicle_sold_for'] = 'A %s jármü eladva ennyiért %s $', ['vehicle_sold_to'] = 'a jármü rendszámmal %s eladva neki: %s', + ['deposit_stock'] = 'beteszek a készletbe', + ['take_stock'] = 'kiveszek a készletböl', ['dealership_stock'] = 'kereskedés készlet', ['amount'] = 'összeg', ['quantity_invalid'] = 'ez érvénytelen mennyiség', ['inventory'] = 'leltár', ['dealership'] = 'Autókereskedő', + ['dealer_customers'] = 'kereskedő ügyfelek', ['have_withdrawn'] = 'kivettél x%s %s', ['have_deposited'] = 'betettél x%s %s', ['boss_actions'] = 'fönök müveletek', + -- sold vehicles ['boss_sold'] = 'Az eladott járművek listája', ['customer_client'] = 'Ügyfél neve', diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/it.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/it.lua index 35ad1c0f6..5a449da99 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/it.lua @@ -25,11 +25,11 @@ Locales['it'] = { ['not_rental'] = 'questo non è un veicolo ~noleggiato', ['not_yours'] = 'questo veicolo non ti appartiene', ['paid_rental'] = 'hai pagato $%s per noleggiare il veicolo con targa %s', - ['paid_rental_evicted'] = 'non hai potuto pagare $%s del noleggio del veicolo con targa %s, è stato restituito al venditore', + ['paid_rental_evicted'] = 'non hai potuto pagare $%s dell affitto del veicolo con targa %s, è stato restituito al venditore', ['pop_vehicle'] = 'Mettere in vendita il veicolo', ['rent_vehicle'] = 'Concessionaria auto - Veicoli a noleggio', ['return_provider_menu'] = 'Concessionaria auto - Restituzione al venditore', - ['rental_amount'] = 'Importo del noleggio', + ['rental_amount'] = 'Importo dell affitto', ['sell_menu'] = 'Premi [E] per vendere le tue %s a $%s', ['set_vehicle_owner_rent'] = 'Noleggia un veicolo', ['set_vehicle_owner_sell'] = 'vendere veicolo', @@ -42,16 +42,19 @@ Locales['it'] = { ['vehicle_set_rented'] = 'il veicolo %s è stato noleggiato a %s', ['vehicle_sold_for'] = 'il %s è stato venduto per $%s', ['vehicle_sold_to'] = 'il veicolo targato %s è stato venduto da %s', + ['deposit_stock'] = 'deposito aziendale', + ['take_stock'] = 'ritiro deposito aziendale', ['dealership_stock'] = 'Azione del venditore', ['amount'] = 'Quantità', ['quantity_invalid'] = 'Importo non valido', ['inventory'] = 'Inventario', ['dealership'] = 'Venditore di auto', + ['dealer_customers'] = 'Clienti del venditore', ['have_withdrawn'] = 'Hai ritirato x%s %s', ['have_deposited'] = 'Hai depositato x%s %s', ['boss_actions'] = 'Azioni del capo', ['invalid_vehicle'] = 'Veicolo non valido', - ['rental_payment'] = 'Pagamento per tutti i noleggi', + -- sold vehicles ['boss_sold'] = 'Elenco dei veicoli venduti', ['customer_client'] = 'Acquirente', diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/nl.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/nl.lua new file mode 100644 index 000000000..5bae0c679 --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/nl.lua @@ -0,0 +1,65 @@ +Locales['nl'] = { + -- global menus + ['not_enough_in_society'] = 'dit zit niet in de inventory van de cardealer !', + ['player_cannot_hold'] = 'je hebt ~r~niet~s~ genoeg plaats in je inventaris!', + ['vehicle_belongs'] = 'een voertuig met kenteken %s is nu van jou', + ['broke_company'] = 'je bedrijf heeft niet genoeg geld in de bank', + ['license_missing'] = 'je hebt geen rijbewijs!', + ['buy_vehicle_shop'] = 'Wil je %s kopen voor €%s?', + ['buy_vehicle'] = 'koop voertuig', + ['car_dealer'] = 'Voertuig verkoop', + ['shop_awaiting_model'] = 'het voertuig is aan het laden, even geduld', + ['create_bill'] = 'creeër rekening', + ['dealer_boss'] = 'Voertuig verkoop - Baas', + ['delivered'] = 'het voertuig is afgeleverd', + ['depop_vehicle'] = 'wil je het voertuig parkeren in de garage?', + ['return_provider'] = 'wil je het voertuig terugsturen naar de eigenaar ?', + ['get_rented_vehicles'] = 'voertuigen te huur', + ['no_current_vehicle'] = 'je hebt momenteel geen voertuig uitstaan', + ['invalid_amount'] = 'ongeldig bedrag', + ['invoice_amount'] = 'factuur bedrag', + ['no'] = 'nee', + ['yes'] = 'ja', + ['no_players'] = 'er zijn geen spelers in de buurt', + ['not_enough_money'] = 'je hebt niet genoeg geld', + ['not_rental'] = 'dit is geen ~r~huur voertuig', + ['not_yours'] = 'dit voertuig is niet van jou', + ['paid_rental'] = 'je hebt €%s betaald voor het huren van een voertuig met kenteken %s', + ['paid_rental_evicted'] = 'je hebt niet genoeg om €%s te betalen voor je gehuurde voertuig met kenteken %s, hij is teruggebracht.', + ['pop_vehicle'] = 'zet voertuig uit voor verkoop', + ['rent_vehicle'] = 'Auto verkoop - Voertuigen te huur', + ['return_provider_menu'] = 'Auto verkoop - Breng voertuig terug', + ['rental_amount'] = 'huur bedrag', + ['sell_menu'] = 'klik op [E] om %s te verkopen voor €%s', + ['set_vehicle_owner_rent'] = 'verhuur voertuig', + ['set_vehicle_owner_sell'] = 'verkoop vuurtuig', + ['shop_menu'] = 'klik op [E] om het menu te gebruiken', + ['generic_shopitem'] = '€%s', + ['vehicle_dealer'] = 'voertuig - Auto verkoop', + ['vehicle_menu'] = 'klik op [E] om je gehuurde voertuig terug te brengen', + ['vehicle_purchased'] = 'je hebt een voertuig gekocht', + ['vehicle_set_owned'] = 'voertuig %s is toegewezen aan %s', + ['vehicle_set_rented'] = 'voertuig %s is gehuurd door %s', + ['vehicle_sold_for'] = 'de %s is verkocht voor €%s', + ['vehicle_sold_to'] = 'het voertuig met kenteken %s is verkocht aan %s', + ['deposit_stock'] = 'sla voorraad op', + ['take_stock'] = 'pak voorraad', + ['dealership_stock'] = 'verkoop voorraad', + ['amount'] = 'bedrag', + ['quantity_invalid'] = 'ongeldig bedrag', + ['inventory'] = 'inventaris', + ['dealership'] = 'Auto verkoop', + ['dealer_customers'] = 'Klanten', + ['have_withdrawn'] = 'je hebt x%s %s gepakt', + ['have_deposited'] = 'je hebt x%s %s opgeslagen', + ['boss_actions'] = 'baas acties', + ['invalid_vehicle'] = 'Onjuist voertuig', + + -- sold vehicles + ['boss_sold'] = 'lijst van verkochte voertuigen', + ['customer_client'] = 'klant naam', + ['customer_model'] = 'voertuig model', + ['customer_plate'] = 'kenteken voertuig', + ['customer_soldby'] = 'verkocht door', + ['customer_date'] = 'datum', +} diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/pl.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/pl.lua index f0017b9c1..f6144bdf8 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/pl.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/pl.lua @@ -42,11 +42,14 @@ Locales['pl'] = { ['vehicle_set_rented'] = 'pojazd %s został wynajęty przez %s', ['vehicle_sold_for'] = 'the %s has been sold for $%s', ['vehicle_sold_to'] = 'pojazd %s został sprzedany do %s', + ['deposit_stock'] = 'deponuj przedmioty', + ['take_stock'] = 'wyciągnij przedmioty', ['dealership_stock'] = 'zaopatrzenie salonu', ['amount'] = 'suma', ['quantity_invalid'] = 'nieprawidłowa ilość', ['inventory'] = 'ekwipunek', ['dealership'] = 'sprzedawca Aut', + ['dealer_customers'] = 'klienci salonu', ['have_withdrawn'] = 'wyciągasz x%s %s', ['have_deposited'] = 'deponujesz x%s %s', ['boss_actions'] = 'akcje szefa', diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/si.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/si.lua deleted file mode 100644 index 7d18447e7..000000000 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/si.lua +++ /dev/null @@ -1,61 +0,0 @@ -Locales['si'] = { - -- globalni meniji - ['not_enough_in_society'] = 'v družbi ni dovolj tega predmeta!', - ['player_cannot_hold'] = 'v svojem inventarju nimaš dovolj prostega prostora!', - ['vehicle_belongs'] = 'vozilo s tablico %s zdaj pripada you', - ['broke_company'] = 'na računu podjetja nimate dovolj denarja', - ['license_missing'] = 'nimaš vozniškega dovoljenja!', - ['buy_vehicle_shop'] = 'želite kupiti %s za $%s?', - ['buy_vehicle'] = 'kupi vozilo', - ['car_dealer'] = 'prodajalna avtomobilov', - ['shop_awaiting_model'] = 'vozilo se trenutno nalaga, počakajte', - ['create_bill'] = 'ustvari račun', - ['dealer_boss'] = 'prodajalec avtomobilov - šef', - ['delivered'] = 'vozilo je bilo dostavljeno prodajalcu', - ['depop_vehicle'] = 'vrni vozilo v servis', - ['return_provider'] = 'vrni vozilo ponudniku', - ['get_rented_vehicles'] = 'vozila za najem', - ['no_current_vehicle'] = 'trenutno nimate razstavljenega vozila', - ['invalid_amount'] = 'neveljaven znesek', - ['invoice_amount'] = 'znesek na računu', - ['no'] = 'ne', - ["yes"] = "yes", - ['no_players'] = 'v vaši bližini ni igralcev', - ['not_enough_money'] = 'nimate dovolj denarja', - ['not_rental'] = 'to ni vozilo za izposojo', - ['not_yours'] = 'to vozilo vam ne pripada', - ['paid_rental'] = 'za najem vozila s tablico %s ste plačali $%s', - ['paid_rental_evicted'] = 'niste mogli plačati $%s za najeto vozilo s tablico %s, zato je bilo vrnjeno prodajalni', - ['pop_vehicle'] = 'daj vozilo v prodajo', - ['rent_vehicle'] = 'prodajalec avtomobilov - vozila za najem', - ['return_provider_menu'] = 'car Dealer - Return vehicle to the provider', - ['rent_amount'] = 'znesek najema', - ['sell_menu'] = 'pritisnite [E], da prodate svoje %s za $%s', - ['set_vehicle_owner_rent'] = 'najem vozila', - ['set_vehicle_owner_sell'] = 'prodati vozilo', - ['shop_menu'] = 'pritisnite [E] za dostop do menija', - ['generic_shopitem'] = '$%s', - ['vehicle_dealer'] = 'vozilo - prodajalec avtomobilov', - ['vehicle_menu'] = 'pritisnite [E], da vrnete najeto vozilo', - ['vehicle_purchased'] = 'kupili ste vozilo', - ['vehicle_set_owned'] = 'vozilo %s je bilo dodeljeno %s', - ['vehicle_set_rented'] = 'vozilo %s je bilo izposojeno %s', - ['vehicle_sold_for'] = 'vozilo %s je bilo sold za $%s', - ['vehicle_sold_to'] = 'vozilo s tablico %s je bilo prodano %s', - ['dealership_stock'] = 'zaloga trgovca', - ['amount'] = 'znesek', - ['quantity_invalid'] = 'to je neveljavna količina', - ['inventory'] = 'zaloga', - ['dealership'] = 'prodajalec avtomobilov', - ['have_withdrawn'] = 'umaknili ste x%s %s', - ['have_deposited'] = 'ste deponirali x%s %s', - ['boss_actions'] = 'dejanja šefa', - ['invalid_vehicle'] = 'Neveljavno vozilo', - -- prodana vozila - ['boss_sold'] = 'seznam prodanih vozil', - ['customer_client'] = 'ime stranke', - ['customer_model'] = 'model vozila', - ['customer_plate'] = 'registrska številka vozila', - ['customer_soldby'] = 'prodano do', - ['customer_date'] = 'datum', -} diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/sr.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/sr.lua new file mode 100644 index 000000000..75289b03b --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/sr.lua @@ -0,0 +1,66 @@ + +Locales['sr'] = { + -- global menus + ['not_enough_in_society'] = 'Nema dovoljno u kompaniji!', + ['player_cannot_hold'] = 'Nemate dovoljno prostora u inventaru!', + ['vehicle_belongs'] = 'Vozilo sa tablicama %s je sada vaše', + ['broke_company'] = 'Nemate dovoljno novca na računu kompanije!', + ['license_missing'] = 'Vi nemate vozačku dozvolu!', + ['buy_vehicle_shop'] = 'Da li želite da kupite %s za $%s?', + ['buy_vehicle'] = 'Kupi Vozilo', + ['car_dealer'] = 'AutoSalon', + ['shop_awaiting_model'] = 'Model vozila se učitava, molimo sačekajte.', + ['create_bill'] = 'Napravi Račun', + ['dealer_boss'] = 'AutoSalon - Boss', + ['delivered'] = 'Vozilo je dostavljeno dileru', + ['depop_vehicle'] = 'Vrati vozilo u garažu', + ['return_provider'] = 'Vrati vozilo prodavcu', + ['get_rented_vehicles'] = 'Vozila za iznajmljivanje', + ['no_current_vehicle'] = 'Trenutno nema izloženih vozila!', + ['invalid_amount'] = 'Nevažeći iznos', + ['invoice_amount'] = 'Iznos Računa', + ['no'] = 'Ne', + ['yes'] = 'Da', + ['no_players'] = 'Nema osobe u blizini', + ['not_enough_money'] = 'Nemaš dovoljno novca', + ['not_rental'] = 'Ovo nije ~r~iznajmljeno vozilo', + ['not_yours'] = 'Ovo vozilo nije tvoje!', + ['paid_rental'] = 'Platili ste $%s za iznajmljivanje vozila sa tablicama %s', + ['paid_rental_evicted'] = 'Nemaš dovoljno novca da platiš $%s za iznajmljeno vozilo sa tablicama %s, vozilo ti je oduzeto i vraćeno autosalonu', + ['pop_vehicle'] = 'Izbaci vozilo na prodaju', + ['rent_vehicle'] = 'AutoSalon - Vozilo za iznajmljivanje', + ['return_provider_menu'] = 'AutoSalon - Vrati vozilo', + ['rental_amount'] = 'Iznos Rente', + ['sell_menu'] = 'Pritisni [E] da prodaš tvoj %s za $%s', + ['set_vehicle_owner_rent'] = 'Iznajmi vozilo', + ['set_vehicle_owner_sell'] = 'Prodaj vozilo', + ['shop_menu'] = 'Pritisni [E] da pristupiš meniju', + ['generic_shopitem'] = '$%s', + ['vehicle_dealer'] = 'Vozilo - AutoSalon', + ['vehicle_menu'] = 'Pritisni [E] da vratiš iznajmljeno vozilo', + ['vehicle_purchased'] = 'Kupili ste vozilo', + ['vehicle_set_owned'] = 'Vozilo %s je prepisano osobi %s', + ['vehicle_set_rented'] = 'Vozilo %s je iznajmljeno za %s', + ['vehicle_sold_for'] = '%s je prodat za $%s', + ['vehicle_sold_to'] = 'Vozilo sa tablicama %s prodato je osobi %s', + ['deposit_stock'] = 'Ostavi', + ['take_stock'] = 'Uzmi', + ['dealership_stock'] = 'Autosalon Ostava', + ['amount'] = 'Količina', + ['quantity_invalid'] = 'Nevažeća količina!', + ['inventory'] = 'Inventar', + ['dealership'] = 'Diler Vozila', + ['dealer_customers'] = 'Kupci', + ['have_withdrawn'] = 'Podigli ste x%s %s', + ['have_deposited'] = 'Ostavili ste x%s %s', + ['boss_actions'] = 'Boss Akcije', + ['invalid_vehicle'] = 'Pogrešno Vozilo', + + -- sold vehicles + ['boss_sold'] = 'Lista prodatih vozila', + ['customer_client'] = 'Ime Kupca', + ['customer_model'] = 'Model', + ['customer_plate'] = 'Tablice', + ['customer_soldby'] = 'Prodato od strane', + ['customer_date'] = 'Datum', +} diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/sv.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/sv.lua deleted file mode 100644 index 0f9440404..000000000 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/sv.lua +++ /dev/null @@ -1,61 +0,0 @@ -Locales['sv'] = { - -- global menus - ['not_enough_in_society'] = 'det finns inte tillräckligt många av ~r~det föremålet i förrådet!', - ['player_cannot_hold'] = 'du har ~r~inte tillräckligt mycketplats på dig!', - ['vehicle_belongs'] = 'fordonet med reg numret %s tillhör nu dig', - ['broke_company'] = 'det finns inte tillräckligt mycket pengar i företagskontot', - ['license_missing'] = 'du är inte behörig att köpa bilar, B-körkort krävs!', - ['buy_vehicle_shop'] = 'vill du köpa in %s för %s SEK?', - ['buy_vehicle'] = 'Köp in fordon', - ['car_dealer'] = 'bilförsäljare', - ['shop_awaiting_model'] = 'fordon laddas in, vänligen vänta', - ['create_bill'] = 'ge faktura', - ['dealer_boss'] = 'chefmeny', - ['delivered'] = 'fordonet har lämnats tillbaka till bilförsäljaren', - ['depop_vehicle'] = 'ställ tillbaka fordonet', - ['return_provider'] = 'sälj tillbaka fordon till leverantör', - ['get_rented_vehicles'] = 'uthyrda fordon', - ['no_current_vehicle'] = 'du har inget fordon ute till salu', - ['invalid_amount'] = 'ogiltigt belopp', - ['invoice_amount'] = 'belopp att betala', - ['no'] = 'nej', - ['yes'] = 'ja', - ['no_players'] = 'det finns ingen i närheten', - ['not_enough_money'] = 'du har inte tillräckligt mycket pengar', - ['not_rental'] = 'detta är inte ett ~r~uthyrt fordon', - ['not_yours'] = 'det här fordonet tillhör inte dig', - ['paid_rental'] = 'du har betalat %s SEK för att hyra ett fordon med reg nummer %s', - ['paid_rental_evicted'] = 'du hade ej råd att betala %s SEK för ditt hyrda fordon med reg nummer %s, den har tagits av bilförsäljaren', - ['pop_vehicle'] = 'ställ ut fordon till salu', - ['rent_vehicle'] = 'bilförsäljare - fordon för uthyrning', - ['return_provider_menu'] = 'bilförsäljare - sälj tillbaka fordon till leverantör', - ['rental_amount'] = 'uthyrningsbelopp', - ['sell_menu'] = 'tryck [E] för att sälja %s för %s SEK', - ['set_vehicle_owner_rent'] = 'hyr ut fordon', - ['set_vehicle_owner_sell'] = 'sälj fordon', - ['shop_menu'] = 'tryck [E] för öppna bilförsäljarsmenyn.', - ['generic_shopitem'] = '%s SEK', - ['vehicle_dealer'] = 'bilförsäljare - fordon för visning', - ['vehicle_menu'] = 'tryck på [E] för att ~o~lämna tillbaka fordonet till bilförsäljaren.', - ['vehicle_purchased'] = 'du köpte fordonet', - ['vehicle_set_owned'] = 'fordonet %s har tilldelats till %s', - ['vehicle_set_rented'] = 'fordonet %s har hyrts ut till %s', - ['vehicle_sold_for'] = '%s har sålts för %s SEK', - ['vehicle_sold_to'] = '%s har sålts till %s', - ['dealership_stock'] = 'bilförsäljares förråd', - ['amount'] = 'mängd', - ['quantity_invalid'] = 'ogiltig mängd', - ['inventory'] = 'förråd', - ['dealership'] = 'bilförsäljare', - ['have_withdrawn'] = 'du har tagit ut x%s %s', - ['have_deposited'] = 'du har lagt in x%s %s', - ['boss_actions'] = 'chef handlingar', - ['invalid_vehicle'] = 'ogiltigt fordon', - -- sold vehicles - ['boss_sold'] = 'lista av sålda fordon', - ['customer_client'] = 'kund', - ['customer_model'] = 'bil modell', - ['customer_plate'] = 'registreringsnummer', - ['customer_soldby'] = 'såld av', - ['customer_date'] = 'datum', -} diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/locales/zh-cn.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/zh-cn.lua new file mode 100644 index 000000000..c615ac235 --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/locales/zh-cn.lua @@ -0,0 +1,65 @@ +Locales['zh-cn'] = { + -- global menus + ['not_enough_in_society'] = '很抱歉!暂无足够的~r~物品~s~项目!', + ['player_cannot_hold'] = '很抱歉!您的背包~r~尚无足够~s~空间!', + ['vehicle_belongs'] = '车牌号为%s的载具现已注册您的名下', + ['broke_company'] = '当前公司对外账户暂无足够的资金!', + ['license_missing'] = '由于您尚未获取到驾驶执照,无法于此处购买车辆!', + ['buy_vehicle_shop'] = '确认购买车辆%s -支付$%s?', + ['buy_vehicle'] = '购买车辆', + ['car_dealer'] = '车辆商店', + ['shop_awaiting_model'] = '当前车辆数据正在加载, 请耐心等待', + ['create_bill'] = '创建账单', + ['dealer_boss'] = '汽车经销商 - 老板', + ['delivered'] = '该车辆已交付给经销商', + ['depop_vehicle'] = '将车辆返回车库', + ['return_provider'] = '将车辆归还给供应商', + ['get_rented_vehicles'] = '出租载具', + ['no_current_vehicle'] = '您目前没有展示车辆', + ['invalid_amount'] = '无效金额', + ['invoice_amount'] = '账单金额', + ['no'] = '否', + ['yes'] = '是', + ['no_players'] = '附近暂无其他市民!', + ['not_enough_money'] = '当前账户暂无足够资金!', + ['not_rental'] = '此载具目前不对外~r~出租~s~!', + ['not_yours'] = '此载具并未注册于您的名下', + ['paid_rental'] = '已支付$%s用于租用载具:%s', + ['paid_rental_evicted'] = '无法支付:$%s-检测到您名下号牌为:%s租用车辆您已无法继续租用, 它已退还给经销商', + ['pop_vehicle'] = '出售车辆', + ['rent_vehicle'] = '汽车经销商 - 出租车辆', + ['return_provider_menu'] = '汽车经销商 - 将车辆返回给供应商', + ['rental_amount'] = '租金金额', + ['sell_menu'] = '键下 [E] 出售载具 %s - $%s', + ['set_vehicle_owner_rent'] = '设为租用', + ['set_vehicle_owner_sell'] = '设为出售', + ['shop_menu'] = '键下 [E] 访问选单', + ['generic_shopitem'] = '$%s', + ['vehicle_dealer'] = '载具 - 汽车经销商', + ['vehicle_menu'] = '键下 [E] 归还载具', + ['vehicle_purchased'] = '成功购买一辆载具', + ['vehicle_set_owned'] = '载具: %s 已注册至%s名下', + ['vehicle_set_rented'] = '载具: %s 已租用给 %s', + ['vehicle_sold_for'] = '载具: %s 以 $%s 的价格出售!', + ['vehicle_sold_to'] = '号牌为:%s 的载具已被出售给%s', + ['deposit_stock'] = '存入物品', + ['take_stock'] = '取出物品', + ['dealership_stock'] = '经销商仓库', + ['amount'] = '具体数量', + ['quantity_invalid'] = '错误的数量输入!', + ['inventory'] = '库存', + ['dealership'] = '汽车经销商', + ['dealer_customers'] = '客户', + ['have_withdrawn'] = '已提取 %sx%s', + ['have_deposited'] = '已存放 %sx%s', + ['boss_actions'] = '人事管理', + ['invalid_vehicle'] = '无效的车辆数据', + + -- sold vehicles + ['boss_sold'] = '已售车辆', + ['customer_client'] = '客户', + ['customer_model'] = '车辆模型', + ['customer_plate'] = '车牌', + ['customer_soldby'] = '销售者', + ['customer_date'] = '日期', +} diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/de_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/de_esx_vehicleshop.sql index 7ae06cde9..769d88765 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/de_esx_vehicleshop.sql +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/de_esx_vehicleshop.sql @@ -1,21 +1,19 @@ - - INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_cardealer','Händler',1) + ('society_cardealer','Autohändler',1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_cardealer','Händler',1) + ('society_cardealer','Autohändler',1) ; INSERT INTO `jobs` (name, label) VALUES - ('cardealer','Händler') + ('cardealer','Autohändler') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('cardealer',0,'recruit','Neuling',10,'{}','{}'), - ('cardealer',1,'novice','Verkäufer',25,'{}','{}'), - ('cardealer',2,'experienced','Verkaufsleiter',40,'{}','{}'), + ('cardealer',0,'recruit','Rekrut',10,'{}','{}'), + ('cardealer',1,'novice','Neuling',25,'{}','{}'), + ('cardealer',2,'experienced','Erfahren',40,'{}','{}'), ('cardealer',3,'boss','Boss',0,'{}','{}') ; @@ -72,17 +70,17 @@ CREATE TABLE `vehicle_categories` ( INSERT INTO `vehicle_categories` (name, label) VALUES - ('compacts','Compacts'), - ('coupes','Coupés'), - ('sedans','Sedans'), - ('sports','Sports'), - ('sportsclassics','Sports Classics'), - ('super','Super'), - ('muscle','Muscle'), - ('offroad','Off Road'), + ('compacts','Kompaktwagen'), + ('coupes','Coupes'), + ('sedans','Limousinen'), + ('sports','Sportwagen'), + ('sportsclassics','Sportwagen Klassik'), + ('super','Supersportwagen'), + ('muscle','Musclewagen'), + ('offroad','Off-Road'), ('suvs','SUVs'), ('vans','Vans'), - ('motorcycles','Motos') + ('motorcycles','Motorräder') ; CREATE TABLE `vehicles` ( @@ -143,7 +141,7 @@ INSERT INTO `vehicles` (name, model, price, category) VALUES ('Asea','asea',5500,'sedans'), ('Cognoscenti','cognoscenti',55000,'sedans'), ('Emperor','emperor',8500,'sedans'), - ('Fugitive','fugitive',12000,'sedans'), + ('Fugitive','fugitive',1200000,'sedans'), ('Glendale','glendale',6500,'sedans'), ('Intruder','intruder',7500,'sedans'), ('Premier','premier',8000,'sedans'), diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/en_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/en_esx_vehicleshop.sql index f9a714ca1..1413a6a9f 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/en_esx_vehicleshop.sql +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/en_esx_vehicleshop.sql @@ -1,5 +1,3 @@ - - INSERT INTO `addon_account` (name, label, shared) VALUES ('society_cardealer','Cardealer',1) ; diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/es_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/es_esx_vehicleshop.sql index 18e9c7de1..71380b199 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/es_esx_vehicleshop.sql +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/es_esx_vehicleshop.sql @@ -1,5 +1,3 @@ - - INSERT INTO `addon_account` (name, label, shared) VALUES ('society_cardealer','Concesionario',1) ; diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/fi_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/fi_esx_vehicleshop.sql index 6d6b2c5fe..671516da7 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/fi_esx_vehicleshop.sql +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/fi_esx_vehicleshop.sql @@ -1,5 +1,3 @@ - - INSERT INTO `addon_account` (name, label, shared) VALUES ('society_cardealer','Autokauppa',1) ; diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/br_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/fr_esx_vehicleshop.sql similarity index 95% rename from server-data/resources/[esx_addons]/esx_vehicleshop/localization/br_esx_vehicleshop.sql rename to server-data/resources/[esx_addons]/esx_vehicleshop/localization/fr_esx_vehicleshop.sql index 66aa5903f..a9def5126 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/br_esx_vehicleshop.sql +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/fr_esx_vehicleshop.sql @@ -1,22 +1,20 @@ - - INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_cardealer','Vendedor de carros',1) + ('society_cardealer','Concessionnaire',1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_cardealer','Vendedor de carros',1) + ('society_cardealer','Concessionnaire',1) ; INSERT INTO `jobs` (name, label) VALUES - ('cardealer','Vendedor de carros') + ('cardealer','Concessionnaire') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('cardealer',0,'recrutar','Recrutar',10,'{}','{}'), - ('cardealer',1,'novato','Novato',25,'{}','{}'), - ('cardealer',2,'experiente','Experiente',40,'{}','{}'), - ('cardealer',3,'chefe','Chefe',0,'{}','{}') + ('cardealer',0,'recruit','Recrue',10,'{}','{}'), + ('cardealer',1,'novice','Novice',25,'{}','{}'), + ('cardealer',2,'experienced','Expérimenté',40,'{}','{}'), + ('cardealer',3,'boss','Patron',0,'{}','{}') ; CREATE TABLE `cardealer_vehicles` ( @@ -72,16 +70,16 @@ CREATE TABLE `vehicle_categories` ( INSERT INTO `vehicle_categories` (name, label) VALUES - ('compacts','Compactos'), - ('coupes','Cupês'), - ('sedans','Sedans'), - ('sports','Esportes'), - ('sportsclassics','Clássicos Esportivos'), - ('super','Super'), - ('muscle','Músculo'), - ('offroad','Fora da estrada'), + ('compacts','Compacts'), + ('coupes','Coupés'), + ('sedans','Berlines'), + ('sports','Sportives'), + ('sportsclassics','Sportives classiques'), + ('super','Supersportives'), + ('muscle','Muscle'), + ('offroad','Tout-terrains'), ('suvs','SUVs'), - ('vans','Vans'), + ('vans','Fourgonnettes'), ('motorcycles','Motos') ; diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/it_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/it_esx_vehicleshop.sql new file mode 100644 index 000000000..034e2fa7c --- /dev/null +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/it_esx_vehicleshop.sql @@ -0,0 +1,337 @@ +INSERT INTO `addon_account` (name, label, shared) VALUES + ('society_cardealer','Concessionario',1) +; + +INSERT INTO `addon_inventory` (name, label, shared) VALUES + ('society_cardealer','Concessionario',1) +; + +INSERT INTO `jobs` (name, label) VALUES + ('cardealer','Concessionario') +; + +INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES + ('cardealer',0,'Recluta','Recruit',10,'{}','{}'), + ('cardealer',1,'Impiegato','Novice',25,'{}','{}'), + ('cardealer',2,'Responsabile','Experienced',40,'{}','{}'), + ('cardealer',3,'Direttore','Boss',0,'{}','{}') +; + +CREATE TABLE `cardealer_vehicles` ( + `id` int NOT NULL AUTO_INCREMENT, + `vehicle` varchar(255) NOT NULL, + `price` int NOT NULL, + + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + + +CREATE TABLE `vehicle_sold` ( + `client` VARCHAR(50) NOT NULL, + `model` VARCHAR(50) NOT NULL, + `plate` VARCHAR(50) NOT NULL, + `soldby` VARCHAR(50) NOT NULL, + `date` VARCHAR(50) NOT NULL, + + PRIMARY KEY (`plate`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + + +CREATE TABLE `owned_vehicles` ( + `owner` VARCHAR(60) NOT NULL, + `plate` varchar(12) NOT NULL, + `vehicle` longtext, + `type` VARCHAR(20) NOT NULL DEFAULT 'car', + `job` VARCHAR(20) NULL DEFAULT NULL, + `stored` TINYINT(1) NOT NULL DEFAULT '0', + + PRIMARY KEY (`plate`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + + +CREATE TABLE `rented_vehicles` ( + `vehicle` varchar(60) NOT NULL, + `plate` varchar(12) NOT NULL, + `player_name` varchar(255) NOT NULL, + `base_price` int NOT NULL, + `rent_price` int NOT NULL, + `owner` VARCHAR(60) NOT NULL, + + PRIMARY KEY (`plate`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + + +CREATE TABLE `vehicle_categories` ( + `name` varchar(60) NOT NULL, + `label` varchar(60) NOT NULL, + + PRIMARY KEY (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + + +INSERT INTO `vehicle_categories` (name, label) VALUES + ('compacts','Compatte'), + ('coupes','Coupe'), + ('sedans','Sedan'), + ('sports','Sportive'), + ('sportsclassics','Sportive Classiche'), + ('super','Super'), + ('muscle','Muscle'), + ('offroad','Off Road'), + ('suvs','SUV'), + ('vans','Furgoni'), + ('motorcycles','Moto') +; + +CREATE TABLE `vehicles` ( + `name` varchar(60) NOT NULL, + `model` varchar(60) NOT NULL, + `price` int NOT NULL, + `category` varchar(60) DEFAULT NULL, + + PRIMARY KEY (`model`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + + +INSERT INTO `vehicles` (name, model, price, category) VALUES + ('Blade','blade',15000,'muscle'), + ('Buccaneer','buccaneer',18000,'muscle'), + ('Buccaneer Rider','buccaneer2',24000,'muscle'), + ('Chino','chino',15000,'muscle'), + ('Chino Luxe','chino2',19000,'muscle'), + ('Coquette BlackFin','coquette3',55000,'muscle'), + ('Dominator','dominator',35000,'muscle'), + ('Dukes','dukes',28000,'muscle'), + ('Gauntlet','gauntlet',30000,'muscle'), + ('Hotknife','hotknife',125000,'muscle'), + ('Faction','faction',20000,'muscle'), + ('Faction Rider','faction2',30000,'muscle'), + ('Faction XL','faction3',40000,'muscle'), + ('Nightshade','nightshade',65000,'muscle'), + ('Phoenix','phoenix',12500,'muscle'), + ('Picador','picador',18000,'muscle'), + ('Sabre Turbo','sabregt',20000,'muscle'), + ('Sabre GT','sabregt2',25000,'muscle'), + ('Slam Van','slamvan3',11500,'muscle'), + ('Tampa','tampa',16000,'muscle'), + ('Virgo','virgo',14000,'muscle'), + ('Vigero','vigero',12500,'muscle'), + ('Voodoo','voodoo',7200,'muscle'), + ('Blista','blista',8000,'compacts'), + ('Brioso R/A','brioso',18000,'compacts'), + ('Issi','issi2',10000,'compacts'), + ('Panto','panto',10000,'compacts'), + ('Prairie','prairie',12000,'compacts'), + ('Bison','bison',45000,'vans'), + ('Bobcat XL','bobcatxl',32000,'vans'), + ('Burrito','burrito3',19000,'vans'), + ('Burrito','gburrito2',29000,'vans'), + ('Camper','camper',42000,'vans'), + ('Gang Burrito','gburrito',45000,'vans'), + ('Journey','journey',6500,'vans'), + ('Minivan','minivan',13000,'vans'), + ('Moonbeam','moonbeam',18000,'vans'), + ('Moonbeam Rider','moonbeam2',35000,'vans'), + ('Paradise','paradise',19000,'vans'), + ('Rumpo','rumpo',15000,'vans'), + ('Rumpo Trail','rumpo3',19500,'vans'), + ('Surfer','surfer',12000,'vans'), + ('Youga','youga',10800,'vans'), + ('Youga Luxuary','youga2',14500,'vans'), + ('Asea','asea',5500,'sedans'), + ('Cognoscenti','cognoscenti',55000,'sedans'), + ('Emperor','emperor',8500,'sedans'), + ('Fugitive','fugitive',12000,'sedans'), + ('Glendale','glendale',6500,'sedans'), + ('Intruder','intruder',7500,'sedans'), + ('Premier','premier',8000,'sedans'), + ('Primo Custom','primo2',14000,'sedans'), + ('Regina','regina',5000,'sedans'), + ('Schafter','schafter2',25000,'sedans'), + ('Stretch','stretch',90000,'sedans'), + ('Super Diamond','superd',130000,'sedans'), + ('Tailgater','tailgater',30000,'sedans'), + ('Warrener','warrener',4000,'sedans'), + ('Washington','washington',9000,'sedans'), + ('Baller','baller2',40000,'suvs'), + ('Baller Sport','baller3',60000,'suvs'), + ('Cavalcade','cavalcade2',55000,'suvs'), + ('Contender','contender',70000,'suvs'), + ('Dubsta','dubsta',45000,'suvs'), + ('Dubsta Luxuary','dubsta2',60000,'suvs'), + ('Fhantom','fq2',17000,'suvs'), + ('Grabger','granger',50000,'suvs'), + ('Gresley','gresley',47500,'suvs'), + ('Huntley S','huntley',40000,'suvs'), + ('Landstalker','landstalker',35000,'suvs'), + ('Mesa','mesa',16000,'suvs'), + ('Mesa Trail','mesa3',40000,'suvs'), + ('Patriot','patriot',55000,'suvs'), + ('Radius','radi',29000,'suvs'), + ('Rocoto','rocoto',45000,'suvs'), + ('Seminole','seminole',25000,'suvs'), + ('XLS','xls',32000,'suvs'), + ('Btype','btype',62000,'sportsclassics'), + ('Btype Luxe','btype3',85000,'sportsclassics'), + ('Btype Hotroad','btype2',155000,'sportsclassics'), + ('Casco','casco',30000,'sportsclassics'), + ('Coquette Classic','coquette2',40000,'sportsclassics'), + ('Manana','manana',12800,'sportsclassics'), + ('Monroe','monroe',55000,'sportsclassics'), + ('Pigalle','pigalle',20000,'sportsclassics'), + ('Stinger','stinger',80000,'sportsclassics'), + ('Stinger GT','stingergt',75000,'sportsclassics'), + ('Stirling GT','feltzer3',65000,'sportsclassics'), + ('Z-Type','ztype',220000,'sportsclassics'), + ('Bifta','bifta',12000,'offroad'), + ('Bf Injection','bfinjection',16000,'offroad'), + ('Blazer','blazer',6500,'offroad'), + ('Blazer Sport','blazer4',8500,'offroad'), + ('Brawler','brawler',45000,'offroad'), + ('Bubsta 6x6','dubsta3',120000,'offroad'), + ('Dune Buggy','dune',8000,'offroad'), + ('Guardian','guardian',45000,'offroad'), + ('Rebel','rebel2',35000,'offroad'), + ('Sandking','sandking',55000,'offroad'), + ('The Liberator','monster',210000,'offroad'), + ('Trophy Truck','trophytruck',60000,'offroad'), + ('Trophy Truck Limited','trophytruck2',80000,'offroad'), + ('Cognoscenti Cabrio','cogcabrio',55000,'coupes'), + ('Exemplar','exemplar',32000,'coupes'), + ('F620','f620',40000,'coupes'), + ('Felon','felon',42000,'coupes'), + ('Felon GT','felon2',55000,'coupes'), + ('Jackal','jackal',38000,'coupes'), + ('Oracle XS','oracle2',35000,'coupes'), + ('Sentinel','sentinel',32000,'coupes'), + ('Sentinel XS','sentinel2',40000,'coupes'), + ('Windsor','windsor',95000,'coupes'), + ('Windsor Drop','windsor2',125000,'coupes'), + ('Zion','zion',36000,'coupes'), + ('Zion Cabrio','zion2',45000,'coupes'), + ('9F','ninef',65000,'sports'), + ('9F Cabrio','ninef2',80000,'sports'), + ('Alpha','alpha',60000,'sports'), + ('Banshee','banshee',70000,'sports'), + ('Bestia GTS','bestiagts',55000,'sports'), + ('Buffalo','buffalo',12000,'sports'), + ('Buffalo S','buffalo2',20000,'sports'), + ('Carbonizzare','carbonizzare',75000,'sports'), + ('Comet','comet2',65000,'sports'), + ('Coquette','coquette',65000,'sports'), + ('Drift Tampa','tampa2',80000,'sports'), + ('Elegy','elegy2',38500,'sports'), + ('Feltzer','feltzer2',55000,'sports'), + ('Furore GT','furoregt',45000,'sports'), + ('Fusilade','fusilade',40000,'sports'), + ('Jester','jester',65000,'sports'), + ('Jester(Racecar)','jester2',135000,'sports'), + ('Khamelion','khamelion',38000,'sports'), + ('Kuruma','kuruma',30000,'sports'), + ('Lynx','lynx',40000,'sports'), + ('Mamba','mamba',70000,'sports'), + ('Massacro','massacro',65000,'sports'), + ('Massacro(Racecar)','massacro2',130000,'sports'), + ('Omnis','omnis',35000,'sports'), + ('Penumbra','penumbra',28000,'sports'), + ('Rapid GT','rapidgt',35000,'sports'), + ('Rapid GT Convertible','rapidgt2',45000,'sports'), + ('Schafter V12','schafter3',50000,'sports'), + ('Seven 70','seven70',39500,'sports'), + ('Sultan','sultan',15000,'sports'), + ('Surano','surano',50000,'sports'), + ('Tropos','tropos',40000,'sports'), + ('Verlierer','verlierer2',70000,'sports'), + ('Adder','adder',900000,'super'), + ('Banshee 900R','banshee2',255000,'super'), + ('Bullet','bullet',90000,'super'), + ('Cheetah','cheetah',375000,'super'), + ('Entity XF','entityxf',425000,'super'), + ('ETR1','sheava',220000,'super'), + ('FMJ','fmj',185000,'super'), + ('Infernus','infernus',180000,'super'), + ('Osiris','osiris',160000,'super'), + ('Pfister','pfister811',85000,'super'), + ('RE-7B','le7b',325000,'super'), + ('Reaper','reaper',150000,'super'), + ('Sultan RS','sultanrs',65000,'super'), + ('T20','t20',300000,'super'), + ('Turismo R','turismor',350000,'super'), + ('Tyrus','tyrus',600000,'super'), + ('Vacca','vacca',120000,'super'), + ('Voltic','voltic',90000,'super'), + ('X80 Proto','prototipo',2500000,'super'), + ('Zentorno','zentorno',1500000,'super'), + ('Akuma','AKUMA',7500,'motorcycles'), + ('Avarus','avarus',18000,'motorcycles'), + ('Bagger','bagger',13500,'motorcycles'), + ('Bati 801','bati',12000,'motorcycles'), + ('Bati 801RR','bati2',19000,'motorcycles'), + ('BF400','bf400',6500,'motorcycles'), + ('BMX (velo)','bmx',160,'motorcycles'), + ('Carbon RS','carbonrs',18000,'motorcycles'), + ('Chimera','chimera',38000,'motorcycles'), + ('Cliffhanger','cliffhanger',9500,'motorcycles'), + ('Cruiser (velo)','cruiser',510,'motorcycles'), + ('Daemon','daemon',11500,'motorcycles'), + ('Daemon High','daemon2',13500,'motorcycles'), + ('Defiler','defiler',9800,'motorcycles'), + ('Double T','double',28000,'motorcycles'), + ('Enduro','enduro',5500,'motorcycles'), + ('Esskey','esskey',4200,'motorcycles'), + ('Faggio','faggio',1900,'motorcycles'), + ('Vespa','faggio2',2800,'motorcycles'), + ('Fixter (velo)','fixter',225,'motorcycles'), + ('Gargoyle','gargoyle',16500,'motorcycles'), + ('Hakuchou','hakuchou',31000,'motorcycles'), + ('Hakuchou Sport','hakuchou2',55000,'motorcycles'), + ('Hexer','hexer',12000,'motorcycles'), + ('Innovation','innovation',23500,'motorcycles'), + ('Manchez','manchez',5300,'motorcycles'), + ('Nemesis','nemesis',5800,'motorcycles'), + ('Nightblade','nightblade',35000,'motorcycles'), + ('PCJ-600','pcj',6200,'motorcycles'), + ('Ruffian','ruffian',6800,'motorcycles'), + ('Sanchez','sanchez',5300,'motorcycles'), + ('Sanchez Sport','sanchez2',5300,'motorcycles'), + ('Sanctus','sanctus',25000,'motorcycles'), + ('Scorcher (velo)','scorcher',280,'motorcycles'), + ('Sovereign','sovereign',22000,'motorcycles'), + ('Shotaro Concept','shotaro',320000,'motorcycles'), + ('Thrust','thrust',24000,'motorcycles'), + ('Tri bike (velo)','tribike3',520,'motorcycles'), + ('Vader','vader',7200,'motorcycles'), + ('Vortex','vortex',9800,'motorcycles'), + ('Woflsbane','wolfsbane',9000,'motorcycles'), + ('Zombie','zombiea',9500,'motorcycles'), + ('Zombie Luxuary','zombieb',12000,'motorcycles'), + ('blazer5', 'blazer5', 1755600, 'offroad'), + ('Ruiner 2', 'ruiner2', 5745600, 'muscle'), + ('Voltic 2', 'voltic2', 3830400, 'super'), + ('Ardent', 'ardent', 1150000, 'sportsclassics'), + ('Oppressor', 'oppressor', 3524500, 'super'), + ('Visione', 'visione', 2250000, 'super'), + ('Retinue', 'retinue', 615000, 'sportsclassics'), + ('Cyclone', 'cyclone', 1890000, 'super'), + ('Rapid GT3', 'rapidgt3', 885000, 'sportsclassics'), + ('raiden', 'raiden', 1375000, 'sports'), + ('Yosemite', 'yosemite', 485000, 'muscle'), + ('Deluxo', 'deluxo', 4721500, 'sportsclassics'), + ('Pariah', 'pariah', 1420000, 'sports'), + ('Stromberg', 'stromberg', 3185350, 'sports'), + ('SC 1', 'sc1', 1603000, 'super'), + ('riata', 'riata', 380000, 'offroad'), + ('Hermes', 'hermes', 535000, 'muscle'), + ('Savestra', 'savestra', 990000, 'sportsclassics'), + ('Streiter', 'streiter', 500000, 'sports'), + ('Kamacho', 'kamacho', 345000, 'offroad'), + ('GT 500', 'gt500', 785000, 'sportsclassics'), + ('Z190', 'z190', 900000, 'sportsclassics'), + ('Viseris', 'viseris', 875000, 'sportsclassics'), + ('Autarch', 'autarch', 1955000, 'super'), + ('Comet 5', 'comet5', 1145000, 'sports'), + ('Neon', 'neon', 1500000, 'sports'), + ('Revolter', 'revolter', 1610000, 'sports'), + ('Sentinel3', 'sentinel3', 650000, 'sports'), + ('Hustler', 'hustler', 625000, 'muscle') +; diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/si_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/nl_esx_vehicleshop.sql similarity index 97% rename from server-data/resources/[esx_addons]/esx_vehicleshop/localization/si_esx_vehicleshop.sql rename to server-data/resources/[esx_addons]/esx_vehicleshop/localization/nl_esx_vehicleshop.sql index 0e23c79a0..b1e1f7ce3 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/si_esx_vehicleshop.sql +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/nl_esx_vehicleshop.sql @@ -1,22 +1,20 @@ - - INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_cardealer','Cardealer',1) + ('society_cardealer','Auto Dealer',1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_cardealer','Cardealer',1) + ('society_cardealer','Auto Dealer',1) ; INSERT INTO `jobs` (name, label) VALUES - ('cardealer','Cardealer') + ('cardealer','Auto Dealer') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('cardealer',0,'recruit','Rekrut',10,'{}','{}'), - ('cardealer',1,'novice','Novinec',25,'{}','{}'), - ('cardealer',2,'experienced','Izkušen',40,'{}','{}'), - ('cardealer',3,'boss','Direktor',0,'{}','{}') + ('cardealer',0,'recruit','In opleiding',10,'{}','{}'), + ('cardealer',1,'novice','Verkoper',25,'{}','{}'), + ('cardealer',2,'experienced','Ervaren Verkoper',40,'{}','{}'), + ('cardealer',3,'boss','Baas',0,'{}','{}') ; CREATE TABLE `cardealer_vehicles` ( diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/pl_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/pl_esx_vehicleshop.sql index bd874b195..cbcd4dab4 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/pl_esx_vehicleshop.sql +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/pl_esx_vehicleshop.sql @@ -1,5 +1,3 @@ - - INSERT INTO `addon_account` (name, label, shared) VALUES ('society_cardealer','Sprzedawca aut',1) ; diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/sv_esx_vehicleshop.sql b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/sr_esx_vehicleshop.sql similarity index 96% rename from server-data/resources/[esx_addons]/esx_vehicleshop/localization/sv_esx_vehicleshop.sql rename to server-data/resources/[esx_addons]/esx_vehicleshop/localization/sr_esx_vehicleshop.sql index 4a72792c8..47d753f42 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/localization/sv_esx_vehicleshop.sql +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/localization/sr_esx_vehicleshop.sql @@ -1,22 +1,20 @@ - - INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_cardealer','Bilförsäljare',1) + ('society_cardealer','Prodavac automobila',1) ; INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_cardealer','Bilförsäljare',1) + ('society_cardealer','Prodavac automobila',1) ; INSERT INTO `jobs` (name, label) VALUES - ('cardealer','Bilförsäljare') + ('cardealer','Prodavac automobila') ; INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('cardealer',0,'recruit','Nyanställd',10,'{}','{}'), - ('cardealer',1,'novice','Nybörjare',25,'{}','{}'), - ('cardealer',2,'experienced','Erfaren',40,'{}','{}'), - ('cardealer',3,'boss','Chef',0,'{}','{}') + ('cardealer',0,'recruit','Početnik',10,'{}','{}'), + ('cardealer',1,'novice','Radnik',25,'{}','{}'), + ('cardealer',2,'experienced','Iskusni radnik',40,'{}','{}'), + ('cardealer',3,'boss','Vlasnik',0,'{}','{}') ; CREATE TABLE `cardealer_vehicles` ( @@ -72,17 +70,17 @@ CREATE TABLE `vehicle_categories` ( INSERT INTO `vehicle_categories` (name, label) VALUES - ('compacts','Småbil'), - ('coupes','Coupés'), + ('compacts','Compacts'), + ('coupes','Coupes'), ('sedans','Sedans'), - ('sports','Sportbil'), - ('sportsclassics','Klassik sportbil'), + ('sports','Sports'), + ('sportsclassics','Sports Classics'), ('super','Super'), - ('muscle','Muskel'), + ('muscle','Muscle'), ('offroad','Off Road'), ('suvs','SUVs'), ('vans','Vans'), - ('motorcycles','Motorcykel') + ('motorcycles','Motos') ; CREATE TABLE `vehicles` ( diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/server/main.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/server/main.lua index 0b9e2501a..b17d42e44 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/server/main.lua @@ -1,8 +1,75 @@ -local categories, vehicles = {}, {} -local vehiclesByModel = {} +local Config = Config + +local vehicleShop = { + categories = {}, + vehicles = {}, + vehiclesByModel = {}, + soldVehicles = {}, + cardealerVehicles = {}, + rentedVehicles = {} +} +CreateThread(function() + while true do + Wait(60000) + collectgarbage("collect") + end +end) + +local function getCategories() + vehicleShop.categories = MySQL.query.await('SELECT * FROM vehicle_categories') + GlobalState.vehicleShop = vehicleShop + return true +end + +local function getVehicles() + vehicleShop.vehicles = MySQL.query.await('SELECT vehicles.*, vehicle_categories.label AS categoryLabel FROM vehicles JOIN vehicle_categories ON vehicles.category = vehicle_categories.name') + + for _, vehicle in pairs(vehicleShop.vehicles) do + vehicleShop.vehiclesByModel[vehicle.model] = vehicle + end + + GlobalState.vehicleShop = vehicleShop + return true +end + +local function getSoldVehicles() + vehicleShop.soldVehicles = MySQL.query.await('SELECT * FROM vehicle_sold ORDER BY DATE DESC') + GlobalState.vehicleShop = vehicleShop + return true +end + +local function getCardealerVehicles() + vehicleShop.cardealerVehicles = MySQL.query.await('SELECT * FROM cardealer_vehicles ORDER BY vehicle ASC') + GlobalState.vehicleShop = vehicleShop + return true +end + +local function getRentedVehicles() + MySQL.query('SELECT * FROM rented_vehicles ORDER BY player_name ASC', function(result) + vehicleShop.rentedVehicles = {} + + for i = 1, #result do + local vehicle = result[i] + vehicleShop.rentedVehicles[#vehicleShop.rentedVehicles + 1] = { + name = vehicle.vehicle, + plate = vehicle.plate, + playerName = vehicle.player_name + } + end + GlobalState.vehicleShop = vehicleShop + return true + end) +end -TriggerEvent('esx_society:registerSociety', 'cardealer', _U('car_dealer'), 'society_cardealer', 'society_cardealer', 'society_cardealer', {type = 'private'}) CreateThread(function() + TriggerEvent('esx_society:registerSociety', 'cardealer', _U('car_dealer'), 'society_cardealer', 'society_cardealer', 'society_cardealer', {type = 'private'}) + + getCategories() + getVehicles() + getSoldVehicles() + getCardealerVehicles() + getRentedVehicles() + local char = Config.PlateLetters char = char + Config.PlateNumbers if Config.PlateUseSpace then char = char + 1 end @@ -12,95 +79,116 @@ CreateThread(function() end end) -function RemoveOwnedVehicle(plate) +local function removeOwnedVehicle(plate) MySQL.update('DELETE FROM owned_vehicles WHERE plate = ?', {plate}) end -AddEventHandler('onResourceStart', function(resourceName) - if resourceName == GetCurrentResourceName() then - SQLVehiclesAndCategories() - end -end) - -function SQLVehiclesAndCategories() - categories = MySQL.query.await('SELECT * FROM vehicle_categories') - vehicles = MySQL.query.await('SELECT vehicles.*, vehicle_categories.label AS categoryLabel FROM vehicles JOIN vehicle_categories ON vehicles.category = vehicle_categories.name') - - for _, vehicle in pairs(vehicles) do - vehiclesByModel[vehicle.model] = vehicle - end - - TriggerClientEvent("esx_vehicleshop:updateVehiclesAndCategories", -1, vehicles, categories, vehiclesByModel) +local function getVehicleFromModel(model) + return vehicleShop.vehiclesByModel[model] end -function getVehicleFromModel(model) - return vehiclesByModel[model] -end - -RegisterNetEvent("esx_vehicleshop:getVehiclesAndCategories", function() - TriggerClientEvent("esx_vehicleshop:updateVehiclesAndCategories", source, vehicles, categories, vehiclesByModel) -end) - RegisterNetEvent('esx_vehicleshop:setVehicleOwnedPlayerId') AddEventHandler('esx_vehicleshop:setVehicleOwnedPlayerId', function(playerId, vehicleProps, model, label) local xPlayer, xTarget = ESX.GetPlayerFromId(source), ESX.GetPlayerFromId(playerId) - if xPlayer.job.name ~= 'cardealer' or not xTarget then + if Player(source).state.job ~= 'cardealer' or not xTarget then return end - MySQL.scalar('SELECT id FROM cardealer_vehicles WHERE vehicle = ?', {model}, - function(id) - if not id then - return + if not model then return end + + for i = 1, #vehicleShop.cardealerVehicles, 1 do + local v = vehicleShop.cardealerVehicles[i] + if v.vehicle == model then + local sqlDel = MySQL.update.await('DELETE FROM cardealer_vehicles WHERE id = ?', {v.id}) + if not sqlDel then return end + table.remove(vehicleShop.cardealerVehicles, i) + GlobalState.vehicleShop = vehicleShop + break end + end - MySQL.update('DELETE FROM cardealer_vehicles WHERE id = ?', {id}, - function(rowsChanged) - if rowsChanged == 1 then - MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (?, ?, ?)', {xTarget.identifier, vehicleProps.plate, json.encode(vehicleProps)}, - function(id) - xPlayer.showNotification(_U('vehicle_set_owned', vehicleProps.plate, xTarget.getName())) - xTarget.showNotification(_U('vehicle_belongs', vehicleProps.plate)) - end) - - MySQL.insert('INSERT INTO vehicle_sold (client, model, plate, soldby, date) VALUES (?, ?, ?, ?, ?)', {xTarget.getName(), label, vehicleProps.plate, xPlayer.getName(), os.date('%Y-%m-%d %H:%M')}) - end - end) + MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (?, ?, ?)', {xTarget.identifier, vehicleProps.plate, json.encode(vehicleProps)}, function(id) + xPlayer.showNotification(_U('vehicle_set_owned', vehicleProps.plate, xTarget.getName())) + xTarget.showNotification(_U('vehicle_belongs', vehicleProps.plate)) end) -end) -ESX.RegisterServerCallback('esx_vehicleshop:getSoldVehicles', function(source, cb) - MySQL.query('SELECT client, model, plate, soldby, date FROM vehicle_sold ORDER BY DATE DESC', function(result) - cb(result) - end) + local sqlIns = MySQL.insert.await('INSERT INTO vehicle_sold (client, model, plate, soldby, date) VALUES (?, ?, ?, ?, ?)', {xTarget.getName(), label, vehicleProps.plate, xPlayer.getName(), os.date('%Y-%m-%d %H:%M')}) + if not sqlIns then return end + vehicleShop.soldVehicles[#vehicleShop.soldVehicles + 1] = {xTarget.getName(), label, vehicleProps.plate, xPlayer.getName(), os.date('%Y-%m-%d %H:%M')} + GlobalState.vehicleShop = vehicleShop end) RegisterNetEvent('esx_vehicleshop:rentVehicle') AddEventHandler('esx_vehicleshop:rentVehicle', function(vehicle, plate, rentPrice, playerId) local xPlayer, xTarget = ESX.GetPlayerFromId(source), ESX.GetPlayerFromId(playerId) - if xPlayer.job.name ~= 'cardealer' or not xTarget then + if Player(source).state.job ~= 'cardealer' or not xTarget then return end - MySQL.single('SELECT id, price FROM cardealer_vehicles WHERE vehicle = ?', {vehicle}, - function(result) - if not result then - return + if not vehicle or not plate or not rentPrice then return end + + local price = nil + + for i = 1, #vehicleShop.cardealerVehicles, 1 do + local v = vehicleShop.cardealerVehicles[i] + if v.vehicle == vehicle then + price = v.price + local sqlDel = MySQL.update.await('DELETE FROM cardealer_vehicles WHERE id = ?', {v.id}) + if not sqlDel then return end + table.remove(vehicleShop.cardealerVehicles, i) + GlobalState.vehicleShop = vehicleShop + break end + end - MySQL.update('DELETE FROM cardealer_vehicles WHERE id = ?', {result.id}, - function(rowsChanged) - if rowsChanged ~= 1 then - return + if not price then return end + + MySQL.insert('INSERT INTO rented_vehicles (vehicle, plate, player_name, base_price, rent_price, owner) VALUES (?, ?, ?, ?, ?, ?)', {vehicle, plate, xTarget.getName(), price, rentPrice, xTarget.identifier}, + function(id) + xPlayer.showNotification(_U('vehicle_set_rented', plate, xTarget.getName())) + end) +end) + +RegisterNetEvent('esx_vehicleshop:getStockItem') +AddEventHandler('esx_vehicleshop:getStockItem', function(itemName, count) + local source = source + local xPlayer = ESX.GetPlayerFromId(source) + + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_cardealer', function(inventory) + local item = inventory.getItem(itemName) + + if count > 0 and item.count >= count then + + if not xPlayer.canCarryItem(itemName, count) then + return xPlayer.showNotification(_U('player_cannot_hold')) end + inventory.removeItem(itemName, count) + xPlayer.addInventoryItem(itemName, count) + xPlayer.showNotification(_U('have_withdrawn', count, item.label)) + else + xPlayer.showNotification(_U('not_enough_in_society')) + end + end) +end) - MySQL.insert('INSERT INTO rented_vehicles (vehicle, plate, player_name, base_price, rent_price, owner) VALUES (?, ?, ?, ?, ?, ?)', {vehicle, plate, xTarget.getName(), result.price, rentPrice, xTarget.identifier}, - function(id) - xPlayer.showNotification(_U('vehicle_set_rented', plate, xTarget.getName())) - end) - end) +RegisterNetEvent('esx_vehicleshop:putStockItems') +AddEventHandler('esx_vehicleshop:putStockItems', function(itemName, count) + local source = source + local xPlayer = ESX.GetPlayerFromId(source) + + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_cardealer', function(inventory) + local item = inventory.getItem(itemName) + + if item.count < 0 then + xPlayer.showNotification(_U('invalid_amount')) + return + end + + xPlayer.removeInventoryItem(itemName, count) + inventory.addItem(itemName, count) + xPlayer.showNotification(_U('have_deposited', count, item.label)) end) end) @@ -108,51 +196,55 @@ ESX.RegisterServerCallback('esx_vehicleshop:buyVehicle', function(source, cb, mo local xPlayer = ESX.GetPlayerFromId(source) local modelPrice = getVehicleFromModel(model).price - if modelPrice and xPlayer.getMoney() >= modelPrice then - xPlayer.removeMoney(modelPrice, "Vehicle Purchase") - - MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (?, ?, ?)', {xPlayer.identifier, plate, json.encode({model = joaat(model), plate = plate}) - }, function(rowsChanged) - xPlayer.showNotification(_U('vehicle_belongs', plate)) - ESX.OneSync.SpawnVehicle(joaat(model), Config.Zones.ShopOutside.Pos, Config.Zones.ShopOutside.Heading,{plate = plate}, function(vehicle) - Wait(100) - local vehicle = NetworkGetEntityFromNetworkId(vehicle) - Wait(300) - TaskWarpPedIntoVehicle(GetPlayerPed(source), vehicle, -1) - end) - cb(true) - end) - else + if not modelPrice then cb(false) + return end -end) -ESX.RegisterServerCallback('esx_vehicleshop:getCommercialVehicles', function(source, cb) - MySQL.query('SELECT price, vehicle FROM cardealer_vehicles ORDER BY vehicle ASC', function(result) - cb(result) + if xPlayer.getMoney() < modelPrice then + cb(false) + return + end + + xPlayer.removeMoney(modelPrice, "Vehicle Purchase") + + MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (?, ?, ?)', {xPlayer.identifier, plate, json.encode({model = joaat(model), plate = plate}) + }, function(rowsChanged) + xPlayer.showNotification(_U('vehicle_belongs', plate)) + ESX.OneSync.SpawnVehicle(joaat(model), Config.Zones.ShopOutside.Pos, Config.Zones.ShopOutside.Heading,{plate = plate}, function(vehicle) + Wait(100) + local vehicle = NetworkGetEntityFromNetworkId(vehicle) + Wait(300) + TaskWarpPedIntoVehicle(GetPlayerPed(source), vehicle, -1) + end) + cb(true) end) end) ESX.RegisterServerCallback('esx_vehicleshop:buyCarDealerVehicle', function(source, cb, model) - local xPlayer = ESX.GetPlayerFromId(source) - - if xPlayer.job.name ~= 'cardealer' then + if Player(source).state.job ~= 'cardealer' then return cb(false) end + local modelPrice = getVehicleFromModel(model).price if not modelPrice then return cb(false) end + TriggerEvent('esx_addonaccount:getSharedAccount', 'society_cardealer', function(account) if account.money < modelPrice then return cb(false) end - account.removeMoney(modelPrice) - MySQL.insert('INSERT INTO cardealer_vehicles (vehicle, price) VALUES (?, ?)', {model, modelPrice}, function(rowsChanged) + if not rowsChanged then + cb(false) + return + end + account.removeMoney(modelPrice) + getCardealerVehicles() cb(true) end) end) @@ -162,71 +254,67 @@ RegisterNetEvent('esx_vehicleshop:returnProvider') AddEventHandler('esx_vehicleshop:returnProvider', function(vehicleModel) local xPlayer = ESX.GetPlayerFromId(source) - if xPlayer.job.name ~= 'cardealer' then + if Player(source).state.job ~= 'cardealer' then return end - MySQL.single('SELECT id, price FROM cardealer_vehicles WHERE vehicle = ?', {vehicleModel}, - function(result) - if not result then - return print(('[^3WARNING^7] Player ^5%s^7 Attempted To Sell Invalid Vehicle - ^5%s^7!'):format(source, vehicleModel)) - end - - local id = result.id - MySQL.update('DELETE FROM cardealer_vehicles WHERE id = ?', {id}, - function(rowsChanged) - if rowsChanged ~= 1 then - return - end - TriggerEvent('esx_addonaccount:getSharedAccount', 'society_cardealer', function(account) - local price = ESX.Math.Round(result.price * 0.75) - local vehicleLabel = getVehicleFromModel(vehicleModel).label - - account.addMoney(price) - xPlayer.showNotification(_U('vehicle_sold_for', vehicleLabel, ESX.Math.GroupDigits(price))) - end) - end) - end) -end) + local id = nil + local price = nil + + for i = 1, #vehicleShop.cardealerVehicles, 1 do + local v = vehicleShop.cardealerVehicles[i] + if v.vehicle == vehicleModel then + id = v.id + price = v.price + local sqlDel = MySQL.update.await('DELETE FROM cardealer_vehicles WHERE id = ?', {v.id}) + if not sqlDel then return end + table.remove(vehicleShop.cardealerVehicles, i) + GlobalState.vehicleShop = vehicleShop + break + end + end -ESX.RegisterServerCallback('esx_vehicleshop:getRentedVehicles', function(source, cb) - MySQL.query('SELECT * FROM rented_vehicles ORDER BY player_name ASC', function(result) - local vehicles = {} + if not id or not price then return end - for i = 1, #result do - local vehicle = result[i] - vehicles[#vehicles + 1] = { - name = vehicle.vehicle, - plate = vehicle.plate, - playerName = vehicle.player_name - } - end + TriggerEvent('esx_addonaccount:getSharedAccount', 'society_cardealer', function(account) + local vehPrice = ESX.Math.Round(price * 0.75) + local vehicleLabel = getVehicleFromModel(vehicleModel).label - cb(vehicles) + account.addMoney(vehPrice) + xPlayer.showNotification(_U('vehicle_sold_for', vehicleLabel, ESX.Math.GroupDigits(vehPrice))) end) end) ESX.RegisterServerCallback('esx_vehicleshop:giveBackVehicle', function(source, cb, plate) - MySQL.single('SELECT base_price, vehicle FROM rented_vehicles WHERE plate = ?', {plate}, - function(result) - if not result then - return cb(false) + local basePrice, vehicle = nil, nil + + if not plate then return end + + for i = 1, #vehicleShop.rentedVehicles, 1 do + local v = vehicleShop.rentedVehicles[i] + if v.plate == plate then + basePrice = v.base_price + vehicle = v.vehicle + local sqlDel = MySQL.update.await('DELETE FROM rented_vehicles WHERE plate = ?', {plate}) + if not sqlDel then return cb(false) end + table.remove(vehicleShop.rentedVehicles, i) + GlobalState.vehicleShop = vehicleShop + break end + end - MySQL.update('DELETE FROM rented_vehicles WHERE plate = ?', {plate}, - function() - MySQL.insert('INSERT INTO cardealer_vehicles (vehicle, price) VALUES (?, ?)', {result.vehicle, result.base_price}) + local sqlIns = MySQL.insert.await('INSERT INTO cardealer_vehicles (vehicle, price) VALUES (?, ?)', {vehicle, basePrice}) + if not sqlIns then return cb(false) end + getCardealerVehicles() - RemoveOwnedVehicle(plate) - cb(true) - end) - end) + removeOwnedVehicle(plate) + cb(true) end) ESX.RegisterServerCallback('esx_vehicleshop:resellVehicle', function(source, cb, plate, model) local xPlayer, resellPrice = ESX.GetPlayerFromId(source) - if xPlayer.job.name == 'cardealer' or not Config.EnablePlayerManagement then + if Player(source).state.job == 'cardealer' or not Config.EnablePlayerManagement then -- calculate the resell price for i=1, #vehicles, 1 do if joaat(vehicles[i].model) == model then @@ -239,35 +327,48 @@ ESX.RegisterServerCallback('esx_vehicleshop:resellVehicle', function(source, cb, print(('[^3WARNING^7] Player ^5%s^7 Attempted To Resell Invalid Vehicle - ^5%s^7!'):format(source, model)) return cb(false) end - MySQL.single('SELECT * FROM rented_vehicles WHERE plate = ?', {plate}, + for i = 1, #vehicleShop.rentedVehicles, 1 do + if vehicleShop.rentedVehicles[i].plate == plate then + cb(false) + return + end + end + MySQL.single('SELECT * FROM owned_vehicles WHERE owner = ? AND plate = ?', {xPlayer.identifier, plate}, function(result) - if result then -- is it a rented vehicle? - return cb(false) -- it is, don't let the player sell it since he doesn't own it + if not result then + return cb(false) end - MySQL.single('SELECT * FROM owned_vehicles WHERE owner = ? AND plate = ?', {xPlayer.identifier, plate}, - function(result) - if not result then -- does the owner match? - return - end - local vehicle = json.decode(result.vehicle) + local vehicle = json.decode(result.vehicle) - if vehicle.model ~= model then - print(('[^3WARNING^7] Player ^5%s^7 Attempted To Resell Vehicle With Invalid Model - ^5%s^7!'):format(source, model)) - return cb(false) - end - if vehicle.plate ~= plate then - print(('[^3WARNING^7] Player ^5%s^7 Attempted To Resell Vehicle With Invalid Plate - ^5%s^7!'):format(source, plate)) - return cb(false) - end + if vehicle.model ~= model then + print(('[^3WARNING^7] Player ^5%s^7 Attempted To Resell Vehicle With Invalid Model - ^5%s^7!'):format(source, model)) + return cb(false) + end + if vehicle.plate ~= plate then + print(('[^3WARNING^7] Player ^5%s^7 Attempted To Resell Vehicle With Invalid Plate - ^5%s^7!'):format(source, plate)) + return cb(false) + end - xPlayer.addMoney(resellPrice, "Sold Vehicle") - RemoveOwnedVehicle(plate) - cb(true) - end) + xPlayer.addMoney(resellPrice, "Sold Vehicle") + removeOwnedVehicle(plate) + cb(true) end) end end) +ESX.RegisterServerCallback('esx_vehicleshop:getStockItems', function(source, cb) + TriggerEvent('esx_addoninventory:getSharedInventory', 'society_cardealer', function(inventory) + cb(inventory.items) + end) +end) + +ESX.RegisterServerCallback('esx_vehicleshop:getPlayerInventory', function(source, cb) + local xPlayer = ESX.GetPlayerFromId(source) + local items = xPlayer.inventory + + cb({items = items}) +end) + ESX.RegisterServerCallback('esx_vehicleshop:isPlateTaken', function(source, cb, plate) MySQL.scalar('SELECT plate FROM owned_vehicles WHERE plate = ?', {plate}, function(result) @@ -286,9 +387,7 @@ end) RegisterNetEvent('esx_vehicleshop:setJobVehicleState') AddEventHandler('esx_vehicleshop:setJobVehicleState', function(plate, state) - local xPlayer = ESX.GetPlayerFromId(source) - - MySQL.update('UPDATE owned_vehicles SET `stored` = ? WHERE plate = ? AND job = ?', {state, plate, xPlayer.job.name}, + MySQL.update('UPDATE owned_vehicles SET `stored` = ? WHERE plate = ? AND job = ?', {state, plate, Player(source).state.job}, function(rowsChanged) if rowsChanged == 0 then print(('[^3WARNING^7] Player ^5%s^7 Attempted To Exploit the Garage!'):format(source, plate)) @@ -296,7 +395,7 @@ AddEventHandler('esx_vehicleshop:setJobVehicleState', function(plate, state) end) end) -function PayRent() +local function payRent() local timeStart = os.clock() print('[^2INFO^7] ^5Rent Payments^7 Initiated') @@ -328,7 +427,7 @@ function PayRent() if bank >= sum and #v > 1 then total = total + sum xPlayer.removeAccountMoney('bank', sum, "Vehicle Rental") - xPlayer.showNotification(_U('rental_payment'):format(ESX.Math.GroupDigits(sum))) + xPlayer.showNotification(('You have paid $%s for all of your rentals'):format(ESX.Math.GroupDigits(sum))) else for i = 1, #v do local rental = v[i] @@ -382,8 +481,9 @@ function PayRent() MySQL.prepare.await('DELETE FROM rented_vehicles WHERE owner = ? AND plate = ?', unrentals) end + getRentedVehicles() print(('[^2INFO^7] ^5Rent Payments^7 took ^5%s^7 ms to execute'):format(ESX.Math.Round((os.time() - timeStart) / 1000000, 2))) end) end -TriggerEvent('cron:runAt', 22, 00, PayRent) \ No newline at end of file +TriggerEvent('cron:runAt', 22, 00, payRent) \ No newline at end of file diff --git a/server-data/resources/[ox]/ox_inventory/data/stashes.lua b/server-data/resources/[ox]/ox_inventory/data/stashes.lua index fa81944d0..ab6561c39 100644 --- a/server-data/resources/[ox]/ox_inventory/data/stashes.lua +++ b/server-data/resources/[ox]/ox_inventory/data/stashes.lua @@ -74,23 +74,4 @@ return { weight = 70000, groups = {['mechanic'] = 0} }, - - { - coords = vec3(-29.287910, -1103.182373, 26.415405), - target = { - loc = vec3(-29.287910, -1103.182373, 26.415405), - length = 0.6, - width = 1.8, - heading = 340, - minZ = 43.34, - maxZ = 44.74, - label = 'Storage' - }, - name = 'cardealerlocker', - label = 'Storage', - owner = false, - slots = 70, - weight = 70000, - groups = {['cardealer'] = 0} - }, -} +} \ No newline at end of file From f624daa8525dfa290c18fdf23fcb1b904a8d57ed Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:04:58 +0100 Subject: [PATCH 2/4] chore: minimize doesjobexist function --- .../resources/[esx]/es_extended/server/functions.lua | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/server-data/resources/[esx]/es_extended/server/functions.lua b/server-data/resources/[esx]/es_extended/server/functions.lua index e67a22475..7cfb89107 100644 --- a/server-data/resources/[esx]/es_extended/server/functions.lua +++ b/server-data/resources/[esx]/es_extended/server/functions.lua @@ -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) From 37486d99dee1f2a28f89798282cbf835df3a6daa Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:10:54 +0100 Subject: [PATCH 3/4] fix lint error --- .../esx_vehicleshop/server/main.lua | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server-data/resources/[esx_addons]/esx_vehicleshop/server/main.lua b/server-data/resources/[esx_addons]/esx_vehicleshop/server/main.lua index b17d42e44..791fffae1 100644 --- a/server-data/resources/[esx_addons]/esx_vehicleshop/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_vehicleshop/server/main.lua @@ -1,12 +1,12 @@ local Config = Config local vehicleShop = { - categories = {}, - vehicles = {}, - vehiclesByModel = {}, - soldVehicles = {}, - cardealerVehicles = {}, - rentedVehicles = {} + categories = {}, + vehicles = {}, + vehiclesByModel = {}, + soldVehicles = {}, + cardealerVehicles = {}, + rentedVehicles = {} } CreateThread(function() while true do @@ -17,17 +17,17 @@ end) local function getCategories() vehicleShop.categories = MySQL.query.await('SELECT * FROM vehicle_categories') - GlobalState.vehicleShop = vehicleShop + GlobalState.vehicleShop = vehicleShop return true end local function getVehicles() vehicleShop.vehicles = MySQL.query.await('SELECT vehicles.*, vehicle_categories.label AS categoryLabel FROM vehicles JOIN vehicle_categories ON vehicles.category = vehicle_categories.name') - + for _, vehicle in pairs(vehicleShop.vehicles) do vehicleShop.vehiclesByModel[vehicle.model] = vehicle end - + GlobalState.vehicleShop = vehicleShop return true end @@ -56,7 +56,7 @@ local function getRentedVehicles() playerName = vehicle.player_name } end - GlobalState.vehicleShop = vehicleShop + GlobalState.vehicleShop = vehicleShop return true end) end @@ -108,7 +108,7 @@ AddEventHandler('esx_vehicleshop:setVehicleOwnedPlayerId', function(playerId, ve end end - MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (?, ?, ?)', {xTarget.identifier, vehicleProps.plate, json.encode(vehicleProps)}, function(id) + MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (?, ?, ?)', {xTarget.identifier, vehicleProps.plate, json.encode(vehicleProps)}, function() xPlayer.showNotification(_U('vehicle_set_owned', vehicleProps.plate, xTarget.getName())) xTarget.showNotification(_U('vehicle_belongs', vehicleProps.plate)) end) @@ -146,7 +146,7 @@ AddEventHandler('esx_vehicleshop:rentVehicle', function(vehicle, plate, rentPric if not price then return end MySQL.insert('INSERT INTO rented_vehicles (vehicle, plate, player_name, base_price, rent_price, owner) VALUES (?, ?, ?, ?, ?, ?)', {vehicle, plate, xTarget.getName(), price, rentPrice, xTarget.identifier}, - function(id) + function() xPlayer.showNotification(_U('vehicle_set_rented', plate, xTarget.getName())) end) end) From be2f57d738d41232e7710c6ce2de8a74298198fd Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:14:24 +0100 Subject: [PATCH 4/4] Remove or statements that don't do stuff --- .../resources/[esx]/esx_notify/Notify.lua | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/server-data/resources/[esx]/esx_notify/Notify.lua b/server-data/resources/[esx]/esx_notify/Notify.lua index 656b378c8..9b586bb76 100644 --- a/server-data/resources/[esx]/esx_notify/Notify.lua +++ b/server-data/resources/[esx]/esx_notify/Notify.lua @@ -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 @@ -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()