Skip to content

Commit 2f7bada

Browse files
authored
Merge pull request #1864 from esx-framework/v1.14.1
Bump legacy version to 1.14.1
2 parents 220a1bf + 8888c6c commit 2f7bada

57 files changed

Lines changed: 878 additions & 300 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

[SQL]/legacy.sql

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ INSERT INTO `addon_account` (`name`, `label`, `shared`) VALUES
1616
('society_cardealer', 'Cardealer', 1),
1717
('society_mechanic', 'Mechanic', 1),
1818
('society_police', 'Police', 1),
19-
('society_taxi', 'Taxi', 1);
19+
('society_taxi', 'Taxi', 1),
20+
('bank_savings','Savings account',0);
2021

2122
-- --------------------------------------------------------
2223

@@ -89,7 +90,7 @@ CREATE TABLE `billing` (
8990
`identifier` varchar(60) NOT NULL,
9091
`sender` varchar(60) NOT NULL,
9192
`target_type` varchar(50) NOT NULL,
92-
`target` varchar(40) NOT NULL,
93+
`target` varchar(60) NOT NULL,
9394
`label` varchar(255) NOT NULL,
9495
`amount` int(11) NOT NULL
9596
) ENGINE=InnoDB;
@@ -364,7 +365,7 @@ CREATE TABLE `rented_vehicles` (
364365
`player_name` varchar(255) NOT NULL,
365366
`base_price` int(11) NOT NULL,
366367
`rent_price` int(11) NOT NULL,
367-
`owner` varchar(22) NOT NULL
368+
`owner` varchar(60) NOT NULL
368369
) ENGINE=InnoDB;
369370

370371
--
@@ -749,7 +750,8 @@ ALTER TABLE `addon_account`
749750
ALTER TABLE `addon_account_data`
750751
ADD PRIMARY KEY (`id`),
751752
ADD UNIQUE KEY `index_addon_account_data_account_name_owner` (`account_name`,`owner`),
752-
ADD KEY `index_addon_account_data_account_name` (`account_name`);
753+
ADD KEY `index_addon_account_data_account_name` (`account_name`),
754+
ADD KEY `esx_addon_account_data_owner` (`owner`);
753755

754756
--
755757
-- Indexes for table `addon_inventory`
@@ -764,13 +766,15 @@ ALTER TABLE `addon_inventory_items`
764766
ADD PRIMARY KEY (`id`),
765767
ADD KEY `index_addon_inventory_items_inventory_name_name` (`inventory_name`,`name`),
766768
ADD KEY `index_addon_inventory_items_inventory_name_name_owner` (`inventory_name`,`name`,`owner`),
767-
ADD KEY `index_addon_inventory_inventory_name` (`inventory_name`);
769+
ADD KEY `index_addon_inventory_inventory_name` (`inventory_name`),
770+
ADD KEY `esx_addon_inventory_items_owner` (`owner`);
768771

769772
--
770773
-- Indexes for table `billing`
771774
--
772775
ALTER TABLE `billing`
773-
ADD PRIMARY KEY (`id`);
776+
ADD PRIMARY KEY (`id`),
777+
ADD KEY `esx_billing_identifier` (`identifier`);
774778

775779
--
776780
-- Indexes for table `cardealer_vehicles`
@@ -790,7 +794,8 @@ ALTER TABLE `datastore`
790794
ALTER TABLE `datastore_data`
791795
ADD PRIMARY KEY (`id`),
792796
ADD UNIQUE KEY `index_datastore_data_name_owner` (`name`,`owner`),
793-
ADD KEY `index_datastore_data_name` (`name`);
797+
ADD KEY `index_datastore_data_name` (`name`),
798+
ADD KEY `esx_datastore_data_owner` (`owner`);
794799

795800
--
796801
-- Indexes for table `items`
@@ -821,7 +826,8 @@ ALTER TABLE `licenses`
821826
-- Indexes for table `owned_vehicles`
822827
--
823828
ALTER TABLE `owned_vehicles`
824-
ADD PRIMARY KEY (`plate`);
829+
ADD PRIMARY KEY (`plate`),
830+
ADD KEY `esx_owned_vehicles_owner` (`owner`);
825831

826832
--
827833
--
@@ -840,7 +846,8 @@ ALTER TABLE `rented_vehicles`
840846
-- Indexes for table `society_moneywash`
841847
--
842848
ALTER TABLE `society_moneywash`
843-
ADD PRIMARY KEY (`id`);
849+
ADD PRIMARY KEY (`id`),
850+
ADD KEY `esx_society_moneywash_identifier` (`identifier`);
844851

845852
--
846853
-- Indexes for table `users`
@@ -856,7 +863,8 @@ ALTER TABLE `users`
856863
-- Indexes for table `user_licenses`
857864
--
858865
ALTER TABLE `user_licenses`
859-
ADD PRIMARY KEY (`id`);
866+
ADD PRIMARY KEY (`id`),
867+
ADD KEY `esx_user_licenses_owner` (`owner`);
860868

861869
--
862870
-- Indexes for table `vehicle_categories`
@@ -991,27 +999,6 @@ INSERT INTO `fine_types` (label, amount, category) VALUES
991999
('Fraud', 2000, 2);
9921000

9931001

994-
--
995-
-- ESX Bankerjob
996-
--
997-
998-
INSERT INTO `addon_account` (name, label, shared) VALUES
999-
('society_banker','Bank',1),
1000-
('bank_savings','Savings account',0)
1001-
;
1002-
1003-
INSERT INTO `jobs` (name, label) VALUES
1004-
('banker','Banker')
1005-
;
1006-
1007-
INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
1008-
('banker',0,'advisor','Consultant',10,'{}','{}'),
1009-
('banker',1,'banker','Banker',20,'{}','{}'),
1010-
('banker',2,'business_banker',"Investment banker",30,'{}','{}'),
1011-
('banker',3,'trader','Broker',40,'{}','{}'),
1012-
('banker',4,'boss','Boss',0,'{}','{}')
1013-
;
1014-
10151002
--
10161003
-- ESX Banking
10171004
--

[core]/cron/server/main.lua

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,30 @@ end
2626

2727
---@param timestamp number
2828
function OnTime(timestamp)
29-
for i = 1, #cronJobs, 1 do
30-
local scheduledTimestamp = os.time({
31-
hour = cronJobs[i].h,
32-
min = cronJobs[i].m,
29+
local function scheduledAt(job, dayOffset)
30+
return os.time({
31+
hour = job.h,
32+
min = job.m,
3333
sec = 0, -- Assuming tasks run at the start of the minute
34-
day = os.date("%d", timestamp),
34+
day = os.date("%d", timestamp) + dayOffset,
3535
month = os.date("%m", timestamp),
3636
year = os.date("%Y", timestamp),
3737
})
38+
end
39+
40+
for i = 1, #cronJobs, 1 do
41+
local scheduledTimestamp = scheduledAt(cronJobs[i], 0)
3842

39-
if timestamp >= scheduledTimestamp and (not lastTimestamp or lastTimestamp < scheduledTimestamp) then
43+
if scheduledTimestamp > timestamp then
44+
scheduledTimestamp = scheduledAt(cronJobs[i], -1)
45+
end
46+
47+
if not lastTimestamp or lastTimestamp < scheduledTimestamp then
4048
local d = os.date('*t', scheduledTimestamp).wday
41-
cronJobs[i].cb(d, cronJobs[i].h, cronJobs[i].m)
49+
50+
if not pcall(cronJobs[i].cb, d, cronJobs[i].h, cronJobs[i].m) then
51+
print(("[^1ERROR^7] cron job at ^5%02d:%02d^7 errored, skipping it"):format(cronJobs[i].h, cronJobs[i].m))
52+
end
4253
end
4354
end
4455
end

[core]/es_extended/client/modules/adjustments.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ function Adjustments:DisableNPCDrops()
2525
end
2626

2727
function Adjustments:SeatShuffle()
28-
if Config.DisableVehicleSeatShuff then
28+
if Config.DisableVehicleSeatShuff and not self.seatShuffleRegistered then
29+
self.seatShuffleRegistered = true
30+
2931
AddEventHandler("esx:enteredVehicle", function(vehicle, _, seat)
3032
if seat > -1 then
3133
SetPedIntoVehicle(ESX.PlayerData.ped, vehicle, seat)
@@ -43,7 +45,7 @@ end
4345

4446
function Adjustments:AmmoAndVehicleRewards()
4547
CreateThread(function()
46-
while true do
48+
while ESX.PlayerLoaded do
4749
if Config.DisableDisplayAmmo then
4850
DisplayAmmoThisFrame(false)
4951
end
@@ -175,19 +177,19 @@ function Adjustments:ReplacePlaceholders(text)
175177
local success, result = pcall(cb)
176178

177179
if not success then
178-
error(("Failed to execute placeholder: ^5%s^7\n%s"):format(placeholder, result))
180+
print(("[^1ERROR^7] Failed to execute placeholder: ^5%s^7\n%s"):format(placeholder, result))
179181
result = "Unknown"
180182
end
181183

182-
text = text:gsub(("{%s}"):format(placeholder), tostring(result))
184+
text = text:gsub(("{%s}"):format(placeholder), (tostring(result):gsub("%%", "%%%%")))
183185
end
184186
return text
185187
end
186188

187189
function Adjustments:DiscordPresence()
188190
if Config.DiscordActivity.appId ~= 0 then
189191
CreateThread(function()
190-
while true do
192+
while ESX.PlayerLoaded do
191193
SetDiscordAppId(Config.DiscordActivity.appId)
192194
SetRichPresence(self:ReplacePlaceholders(Config.DiscordActivity.presence))
193195
SetDiscordRichPresenceAsset(Config.DiscordActivity.assetName)
@@ -213,7 +215,9 @@ function Adjustments:WantedLevel()
213215
end
214216

215217
function Adjustments:DisableRadio()
216-
if Config.RemoveHudComponents[16] then
218+
if Config.RemoveHudComponents[16] and not self.disableRadioRegistered then
219+
self.disableRadioRegistered = true
220+
217221
AddEventHandler("esx:enteredVehicle", function(vehicle, plate, seat, displayName, netId)
218222
SetVehRadioStation(vehicle,"OFF")
219223
SetUserRadioControlEnabled(false)
@@ -223,7 +227,7 @@ end
223227

224228
function Adjustments:Multipliers()
225229
CreateThread(function()
226-
while true do
230+
while ESX.PlayerLoaded do
227231
SetPedDensityMultiplierThisFrame(Config.Multipliers.pedDensity)
228232
SetScenarioPedDensityMultiplierThisFrame(Config.Multipliers.scenarioPedDensityInterior, Config.Multipliers.scenarioPedDensityExterior)
229233
SetAmbientVehicleRangeMultiplierThisFrame(Config.Multipliers.ambientVehicleRange)

[core]/es_extended/client/modules/callback.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function ESX.AwaitServerCallback(eventName, ...)
102102

103103
-- if the server callback takes longer than 15 seconds to respond, reject the promise
104104
SetTimeout(15000, function()
105-
if p.state == "pending" then
105+
if p.state == 0 then
106106
p:reject("Server Callback Timed Out")
107107
end
108108
end)

[core]/es_extended/client/modules/events.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ if not Config.CustomInventory then
372372
while true do
373373
local Sleep = 1500
374374
local playerCoords = GetEntityCoords(ESX.PlayerData.ped)
375-
local _, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)
376375

377376
for pickupId, pickup in pairs(pickups) do
378377
local distance = #(playerCoords - pickup.coords)
@@ -383,6 +382,8 @@ if not Config.CustomInventory then
383382

384383
if distance < 1 then
385384
if IsControlJustReleased(0, 38) then
385+
local _, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)
386+
386387
if IsPedOnFoot(ESX.PlayerData.ped) and (closestDistance == -1 or closestDistance > 3) and not pickup.inRange then
387388
pickup.inRange = true
388389

[core]/es_extended/fxmanifest.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ fx_version 'cerulean'
33
game 'gta5'
44
description 'The Core resource that provides the functionalities for all other resources.'
55
lua54 'yes'
6-
version '1.14.0'
6+
version '1.14.1'
77

88
shared_scripts {
99
'@esx_lib/imports.lua',

[core]/es_extended/locale.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function Translate(str, ...) -- Translate string
8282
end
8383

8484
function TranslateCap(str, ...) -- Translate string first char uppercase
85-
return _(str, ...):gsub("^%l", string.upper)
85+
return (_(str, ...):gsub("^%l", string.upper))
8686
end
8787

8888
_ = Translate

0 commit comments

Comments
 (0)