mayWearItem
Whether one player is currently allowed to wear one garment, according to the item lock rules. Resolves the player's job, grade and citizen id server side, so the answer is authoritative.
๐ก Syntax
local allowed = exports['kartik-clothing']:mayWearItem(src, kind, itemId, drawable, texture, gender)๐ฅ Parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
src | number | No | The player's server id. |
kind | string | No | 'component' or 'prop'. |
itemId | number | No | The component or prop slot id. |
drawable | number | No | Drawable index. |
texture | number | Yes | Texture index. Omit to ask about the drawable generally. |
gender | string | Yes | 'male' or 'female'. Defaults to the ped the player is actually on, which is almost always what you mean. |
๐ค Returns
| Type | Description |
|---|---|
boolean | true if the player may wear it. |
๐ป Example
RegisterNetEvent('my-jobs:issueUniform', function()
local src = source
if not exports['kartik-clothing']:mayWearItem(src, 'component', 11, 84) then
return TriggerClientEvent('ox_lib:notify', src, {
description = 'You are not cleared for that uniform.',
type = 'error'
})
end
-- issue it
end)[!NOTE] A lock with no rules is wearable by nobody, so a half-finished lock returns
false.Config.ItemLocksAdminBypassdecides whether admins are exempt.