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] 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