From a31c8787ce4f118ff61a480ea658bc8b2acac125 Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Tue, 19 Sep 2023 23:42:22 +0200 Subject: [PATCH 1/3] fix vehicle spawn --- [core]/es_extended/client/functions.lua | 29 ++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index e90ea73c..091d3131 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -1326,19 +1326,39 @@ 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 @@ -1346,15 +1366,14 @@ 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", From 054c760535160832bb7311748a4b8b9bb6c65558 Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Wed, 20 Sep 2023 00:16:15 +0200 Subject: [PATCH 2/3] change ismodelincdimage to ismodelavehicle, add credits to txadmin for list. --- [core]/es_extended/client/functions.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index 091d3131..bcae0712 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -1324,7 +1324,7 @@ AddEventHandler('onResourceStop', function(resourceName) end end end) - +-- Credits to txAdmin for the list. local mismatchedTypes = { [`airtug`] = "automobile", -- trailer [`avisa`] = "submarine", -- boat @@ -1365,7 +1365,7 @@ local mismatchedTypes = { ---@return string function ESX.GetVehicleType(model) model = type(model) == 'string' and joaat(model) or model - if not IsModelInCdimage(model) then return end + if not IsModelAVehicle(model) then return end if mismatchedTypes[model] then return mismatchedTypes[model] end @@ -1382,4 +1382,4 @@ function ESX.GetVehicleType(model) } return types[vehicleType] or "automobile" -end \ No newline at end of file +end From b3a27994203f6a3cf6ebd33b11471ced6698caa4 Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Wed, 20 Sep 2023 16:33:52 +0200 Subject: [PATCH 3/3] Update functions.lua --- [core]/es_extended/client/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index bcae0712..50300ab4 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -1365,7 +1365,7 @@ local mismatchedTypes = { ---@return string function ESX.GetVehicleType(model) model = type(model) == 'string' and joaat(model) or model - if not IsModelAVehicle(model) then return end + if not IsModelInCdimage(model) then return end if mismatchedTypes[model] then return mismatchedTypes[model] end