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

feat(modules): add duffel bag check #645

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
Loading