From b088ee9613eb00feed47c5544bb636ed319131fa Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Tue, 19 Sep 2023 23:39:10 +0200 Subject: [PATCH 1/2] fix vehicle spawning problem --- [core]/es_extended/client/functions.lua | 50 +++++++++++++++++++++---- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index c4b74ae2..da017799 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -1325,22 +1325,56 @@ AddEventHandler('onResourceStop', function(resourceName) end end) +local mismatchedTypes = { + [`airtug`] = "automobile", -- trailer + [`avisa`] = "submarine", -- boat + [`blimp`] = "heli", -- plane + [`blimp2`] = "heli", -- plane + [`blimp3`] = "heli", -- plane + [`caddy`] = "automobile", -- trailer + [`caddy2`] = "automobile", -- trailer + [`caddy3`] = "automobile", -- trailer + [`chimera`] = "automobile", -- bike + [`docktug`] = "automobile", -- trailer + [`forklift`] = "automobile", -- trailer + [`kosatka`] = "submarine", -- boat + [`mower`] = "automobile", -- trailer + [`policeb`] = "bike", -- automobile + [`ripley`] = "automobile", -- trailer + [`rrocket`] = "automobile", -- bike + [`sadler`] = "automobile", -- trailer + [`sadler2`] = "automobile", -- trailer + [`scrap`] = "automobile", -- trailer + [`slamtruck`] = "automobile", -- trailer + [`Stryder`] = "automobile", -- bike + [`submersible`] = "submarine", -- boat + [`submersible2`] = "submarine", -- boat + [`thruster`] = "heli", -- automobile + [`towtruck`] = "automobile", -- trailer + [`towtruck2`] = "automobile", -- trailer + [`tractor`] = "automobile", -- trailer + [`tractor2`] = "automobile", -- trailer + [`tractor3`] = "automobile", -- trailer + [`trailersmall2`] = "trailer", -- automobile + [`utillitruck`] = "automobile", -- trailer + [`utillitruck2`] = "automobile", -- trailer + [`utillitruck3`] = "automobile", -- trailer +} + ---@param model number|string ---@return string function ESX.GetVehicleType(model) model = type(model) == 'string' and joaat(model) or model - - if model == `submersible` or model == `submersible2` then - return 'submarine' - end - - if model == `blimp` then - return 'heli' + if not IsModelInCdimage(model) then return end + + if mismatchedTypes[model] then + return mismatchedTypes[model] end local vehicleType = GetVehicleClassFromName(model) local types = { [8] = "bike", + [11] = "trailer", [13] = "bike", [14] = "boat", [15] = "heli", @@ -1349,4 +1383,4 @@ function ESX.GetVehicleType(model) } return types[vehicleType] or "automobile" -end +end \ No newline at end of file From 0a91ca9118dc53c1053052dd0e376f05b20492ee Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Tue, 19 Sep 2023 23:40:14 +0200 Subject: [PATCH 2/2] fix 2 --- [core]/es_extended/client/functions.lua | 30 +++++-------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index da017799..e90ea73c 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -1326,39 +1326,19 @@ AddEventHandler('onResourceStop', function(resourceName) end) local mismatchedTypes = { - [`airtug`] = "automobile", -- trailer [`avisa`] = "submarine", -- boat [`blimp`] = "heli", -- plane [`blimp2`] = "heli", -- plane [`blimp3`] = "heli", -- plane - [`caddy`] = "automobile", -- trailer - [`caddy2`] = "automobile", -- trailer - [`caddy3`] = "automobile", -- trailer [`chimera`] = "automobile", -- bike - [`docktug`] = "automobile", -- trailer - [`forklift`] = "automobile", -- trailer [`kosatka`] = "submarine", -- boat - [`mower`] = "automobile", -- trailer [`policeb`] = "bike", -- automobile - [`ripley`] = "automobile", -- trailer [`rrocket`] = "automobile", -- bike - [`sadler`] = "automobile", -- trailer - [`sadler2`] = "automobile", -- trailer - [`scrap`] = "automobile", -- trailer - [`slamtruck`] = "automobile", -- trailer [`Stryder`] = "automobile", -- bike [`submersible`] = "submarine", -- boat [`submersible2`] = "submarine", -- boat [`thruster`] = "heli", -- automobile - [`towtruck`] = "automobile", -- trailer - [`towtruck2`] = "automobile", -- trailer - [`tractor`] = "automobile", -- trailer - [`tractor2`] = "automobile", -- trailer - [`tractor3`] = "automobile", -- trailer [`trailersmall2`] = "trailer", -- automobile - [`utillitruck`] = "automobile", -- trailer - [`utillitruck2`] = "automobile", -- trailer - [`utillitruck3`] = "automobile", -- trailer } ---@param model number|string @@ -1366,15 +1346,15 @@ local mismatchedTypes = { function ESX.GetVehicleType(model) model = type(model) == 'string' and joaat(model) or model if not IsModelInCdimage(model) then return end - - if mismatchedTypes[model] then - return mismatchedTypes[model] - end + + if mismatchedTypes[model] then + return mismatchedTypes[model] + end local vehicleType = GetVehicleClassFromName(model) + local types = { [8] = "bike", - [11] = "trailer", [13] = "bike", [14] = "boat", [15] = "heli",