Exports & Events
All exports and events available to integrate this resource into others.
Suggestions?
If you wish to have any exports and or events added, please head over to our Discord and create a suggestion post. We are happy to allow for easier integration within other resources.
Status Names
When refering to a primary status name, it is the base name of the status. For multi statuses like being high on thc, the primary is "high" and the secondary is "thc". For non-multi statuses like "hunger", both the primary & secondary is "hunger". This is why a secondary name is not always required as input.
Client Sided Exports
Get All Statuses
If you want to grab all initialized & cached statuses straight from our cache, you can use this export. Example:
---@return table<StatusName, PlayerStatuses> | nil @nil when unloaded local statuses = exports["zyke_consumables"]:GetAllRawStatuses()
Shorthands (Hunger, thirst, stress & drunk)
We have created a set of shorthands for common statuses. These are very basic to implement and always returns a number value, 0.0 if not initialized to avoid errors. Example:
local hunger = exports["zyke_consumables"]:GetHunger() local thirst = exports["zyke_consumables"]:GetThirst() local stress = exports["zyke_consumables"]:GetStress() local drunk = exports["zyke_consumables"]:GetDrunk()
Get Raw Status
This export allows you to grab any status, even non-initialized ones in a error-handled environment. It always return a table with a value, 0.0 if not initialized. The second return value indicates if the status you grabbed was initialized or not. Example:
---@return {value: number} | PlayerStatus | AddictionStatus, boolean local status = exports["zyke_consumables"]:GetRawStatus()
Server Sided Exports
Add To Status
Adds an amount to a status. Example:
---@param plyId integer ---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName} ---@param amount number ---@param skipEnsuring? boolean @Only skip if you have a pool with ensured players exports["zyke_status"]:AddToStatus(plyId, statusNames, amount, skipEnsuring)
Remove From Status
Removes an amount from a status. Example:
---@param plyId integer ---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName} ---@param amount number ---@param skipEnsuring? boolean @Only skip if you have a pool with ensured players exports["zyke_status"]:RemoveFromStatus(plyId, statusNames, amount, skipEnsuring)
Auto To Status
Automatically choose add/remove based on amount Example:
---@param plyId integer ---@param statusNames {[1]: PrimaryName, [2]?: SecondaryName} ---@param amount number ---@param skipEnsuring? boolean @Only skip if you have a pool with ensured players exports["zyke_status"]:AutoToStatus(plyId, statusNames, amount, skipEnsuring)
Last updated
Was this helpful?