Skip to content

Commit

Permalink
feat(modules): add duffel bag check
Browse files Browse the repository at this point in the history
  • Loading branch information
5hahfivem committed Dec 22, 2024
1 parent f95bc2d commit a1d4609
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions modules/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,37 @@ qbx.armsWithoutGloves = lib.table.freeze({
}),
})


qbx.duffelbagIndexes = lib.table.freeze({
male = lib.table.freeze({
[40] = true,
[41] = true,
[44] = true,
[45] = true,
[81] = true,
[82] = true,
[85] = true,
[86] = true,
[130] = true,
[131] = true,
[132] = true
}),
female = lib.table.freeze({
[40] = true,
[41] = true,
[44] = true,
[45] = true,
[81] = true,
[82] = true,
[85] = true,
[86] = true,
[131] = true,
[132] = true,
[133] = true
})
})


---Returns the given string with its trailing whitespaces removed.
---@param str string
---@return string
Expand Down Expand Up @@ -401,8 +432,8 @@ else
local text = params.text
local coords = params.coords
local scale = (isScaleparamANumber and vec2(params.scale, params.scale))
or params.scale
or vec2(0.35, 0.35)
or params.scale
or vec2(0.35, 0.35)
local font = params.font or 4
local color = params.color or vec4(255, 255, 255, 255)
local enableDropShadow = params.enableDropShadow or false
Expand Down Expand Up @@ -558,6 +589,15 @@ else
return not tble[armIndex]
end

--- Returns if the local ped is wearing a duffel bag.
--- @return boolean
function qbx.isWearingDuffelbag()
local torsoIndex = GetPedDrawableVariation(cache.ped, 5) -- Duffel bags are in component 5
local model = GetEntityModel(cache.ped)
local tble = qbx.duffelbagIndexes[model == `mp_m_freemode_01` and 'male' or 'female']
return tble[torsoIndex] == true
end

---Attempts to load an audio bank and returns whether it was successful.
---Remember to use `ReleaseScriptAudioBank` since you can only load up to 10 banks.
---@param audioBank string
Expand Down Expand Up @@ -610,4 +650,4 @@ else
end
end

_ENV.qbx = qbx
_ENV.qbx = qbx

0 comments on commit a1d4609

Please sign in to comment.