Skip to content

Commit

Permalink
Merge pull request #731 from bitpredator/dev
Browse files Browse the repository at this point in the history
chore: patch fix esx_vehicleshop
  • Loading branch information
bitpredator authored Jun 19, 2024
2 parents 0e9959f + 4988a24 commit 8301480
Show file tree
Hide file tree
Showing 115 changed files with 3,814 additions and 5,038 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ function OpenVehicleSpawnerMenu(type, station, part, partNum)
local vehicleProps = allVehicleProps[elementG.plate]
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)

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

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

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

esx_vehicleshop Copyright (C) 2015-2024 Jérémie N'gadi
esx_vehicleshop Copyright (C) 2015-2022 Jérémie N'gadi
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
26 changes: 23 additions & 3 deletions server-data/resources/[esx_addons]/esx_vehicleshop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,28 @@ ESX Vehicle Shop adds an vehicle shop to the game, where employeed players can s
* No need to download other resources

* Player management (the car dealer job): billing, boss actions and more!
* [esx_society]
* [cron]
* [esx_society](https://github.com/ESX-Org/esx_society)
* [cron](https://github.com/ESX-Org/cron)

## Download & Installation

### Using [fvm](https://github.com/qlaffont/fvm-installer)

```
fvm install --save --folder=esx esx-org/esx_vehicleshop
```

### Using Git

```
cd resources
git clone https://github.com/ESX-Org/esx_vehicleshop [esx]/esx_vehicleshop
```

### Manually

- Download https://github.com/ESX-Org/esx_vehicleshop/archive/master.zip
- Put it in the `[esx]` directory

### Installation

Expand All @@ -27,7 +47,7 @@ start esx_vehicleshop

esx_vehicleshop - vehicle shop for ESX

Copyright (C) 2015-2024
Copyright (C) 2015-2022 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 the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.

Expand Down
1,706 changes: 898 additions & 808 deletions server-data/resources/[esx_addons]/esx_vehicleshop/client/main.lua

Large diffs are not rendered by default.

31 changes: 19 additions & 12 deletions server-data/resources/[esx_addons]/esx_vehicleshop/client/utils.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
local NumberCharset, Charset = {}, {}
local NumberCharset = {}
local Charset = {}

for i = 48, 57 do table.insert(NumberCharset, string.char(i)) end
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
for i = 65, 90 do
table.insert(Charset, string.char(i))
end
for i = 97, 122 do
table.insert(Charset, string.char(i))
end

function GeneratePlate()
math.randomseed(GetGameTimer())

local generatedPlate = string.upper(GetRandomLetter(Config.PlateLetters) .. (Config.PlateUseSpace and ' ' or '') .. GetRandomNumber(Config.PlateNumbers))
local generatedPlate = string.upper(
GetRandomLetter(Config.PlateLetters)
.. (Config.PlateUseSpace and " " or "")
.. GetRandomNumber(Config.PlateNumbers)
)

local isTaken = IsPlateTaken(generatedPlate)
if isTaken then
Expand All @@ -22,7 +33,7 @@ end
function IsPlateTaken(plate)
local p = promise.new()

ESX.TriggerServerCallback('esx_vehicleshop:isPlateTaken', function(isPlateTaken)
ESX.TriggerServerCallback("esx_vehicleshop:isPlateTaken", function(isPlateTaken)
p:resolve(isPlateTaken)
end, plate)

Expand All @@ -31,14 +42,10 @@ end

function GetRandomNumber(length)
Wait(0)
return length > 0 and GetRandomNumber(length - 1) .. NumberCharset[math.random(1, #NumberCharset)] or ''
return length > 0 and GetRandomNumber(length - 1) .. NumberCharset[math.random(1, #NumberCharset)] or ""
end

function GetRandomLetter(length)
Wait(0)
return length > 0 and GetRandomLetter(length - 1) .. Charset[math.random(1, #Charset)] or ''
return length > 0 and GetRandomLetter(length - 1) .. Charset[math.random(1, #Charset)] or ""
end

function TableInsert(t, v)
t[#t + 1] = v
end
4 changes: 2 additions & 2 deletions server-data/resources/[esx_addons]/esx_vehicleshop/config.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Config = {}
Config.DrawDistance = 10
Config.MarkerColor = { r = 120, g = 120, b = 240 }
Config.EnablePlayerManagement = true
Config.EnablePlayerManagement = true -- enables the actual car dealer job. You'll need bpt_addonaccount, bpt_billing and esx_society
Config.ResellPercentage = 50

Config.Locale = "en"
Config.Locale = GetConvar("esx:locale", "en")

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@


INSERT INTO `addon_account` (name, label, shared) VALUES
('society_cardealer','Cardealer',1)
('society_cardealer','Concessionnaire',1)
;

INSERT INTO `addon_inventory` (name, label, shared) VALUES
('society_cardealer','Cardealer',1)
('society_cardealer','Concesionnaire',1)
;

INSERT INTO `jobs` (name, label) VALUES
('cardealer','Cardealer')
('cardealer','Concessionnaire')
;

INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
('cardealer',0,'recruit','Recruit',10,'{}','{}'),
('cardealer',0,'recruit','Recrue',10,'{}','{}'),
('cardealer',1,'novice','Novice',25,'{}','{}'),
('cardealer',2,'experienced','Experienced',40,'{}','{}'),
('cardealer',3,'boss','Boss',0,'{}','{}')
('cardealer',2,'experienced','Experimente',40,'{}','{}'),
('cardealer',3,'boss','Patron',0,'{}','{}')
;

CREATE TABLE `cardealer_vehicles` (
Expand Down Expand Up @@ -71,7 +73,7 @@ CREATE TABLE `vehicle_categories` (

INSERT INTO `vehicle_categories` (name, label) VALUES
('compacts','Compacts'),
('coupes','Coupes'),
('coupes','Coupés'),
('sedans','Sedans'),
('sports','Sports'),
('sportsclassics','Sports Classics'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fx_version("cerulean")
fx_version("adamant")
game("gta5")
lua54("yes")
description("ESX Vehicle Shop")
Expand Down
65 changes: 0 additions & 65 deletions server-data/resources/[esx_addons]/esx_vehicleshop/locales/cs.lua

This file was deleted.

65 changes: 0 additions & 65 deletions server-data/resources/[esx_addons]/esx_vehicleshop/locales/da.lua

This file was deleted.

65 changes: 0 additions & 65 deletions server-data/resources/[esx_addons]/esx_vehicleshop/locales/de.lua

This file was deleted.

Loading

0 comments on commit 8301480

Please sign in to comment.