Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 2 for vehicle spawn #1221

Merged
merged 5 commits into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 40 additions & 7 deletions [core]/es_extended/client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1324,23 +1324,56 @@ 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
---@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",
Expand Down
Loading