Merge pull request #1221 from Arctos2win/vehicle-fix-1

fix 2 for vehicle spawn
This commit is contained in:
Gellipapa
2023-09-20 19:45:44 +02:00
committed by GitHub
+26 -7
View File
@@ -1324,21 +1324,41 @@ AddEventHandler('onResourceStop', function(resourceName)
end
end
end)
-- Credits to txAdmin for the list.
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",
@@ -1363,4 +1382,4 @@ function ESX.GetVehicleType(model)
}
return types[vehicleType] or "automobile"
end
end