Special Slots
Special Slots Events API
The Special Slots API allows developers to register custom events for special inventory slots (tool, armour, drug, radio, backpack, identification, phone, tablet, key, wallet).
Available Slots
Available slots are configured via the inventory:specialslots convar in your server.cfg. By default, they include:
tool
Tools
armour
Protective vests
drug
Substances / medications
radio
Communication radios
backpack
Backpacks
identification
Identity documents
phone
Mobile phones
tablet
Electronic tablets
key
Keys
wallet
Wallets
Registering Events
Use the RegisterSpecialSlotEvent export to register a slot with its events:
Available Events
onEquip
Triggered when an item is placed in the special slot.
Parameters:
slotData
table
Data of the equipped item (name, count, metadata, etc.)
Example:
onUnequip
Triggered when an item is removed from the special slot.
Parameters:
slotData
table
Data of the item that was unequipped
Example:
onTick
Executed periodically while the item remains in the special slot.
Parameters:
slotData
table
Updated data of the equipped item
Example:
Tick Rate Configuration
You can configure the frequency of onTick execution using the tickRate property in milliseconds:
If tickRate is not specified, the default value is 100ms.
Performance Note: Very low values (such as 1ms) can impact server performance. Use the highest value that is functional for your use case.
Complete Examples
Tool with Durability
Radio with Channel Verification
Phone with State Updates
Manual Event Triggering
You can manually trigger events using the TriggerSpecialSlotEvent export:
Parameters:
slotName
string
Name of the slot (tool, radio, etc.)
eventType
string
Event type (onEquip, onUnequip, onTick)
...
any
Additional arguments for the callback
Returns:
success
boolean
Whether the callback executed without errors
result/error
any
Callback result or error message
Important Notes
Slot Data (slotData)
The slotData parameter contains the equipped item's information and is automatically updated. Its general structure includes:
Avoid Heavy Operations in onTick
If you need to perform expensive operations inside onTick, consider using Citizen.CreateThread to avoid blocking the cycle:
Last updated