Zyke Resources' Products
DiscordStore
  • Introduction
  • Common Issues
    • zyke_lib error
    • Lacking Entitlement
    • UI Not Working
    • Missing Files Via FTP
    • Resource Starting Sequence
    • Item Not Usable
    • Any other issues?
  • FAQ
  • Paid Resources
    • Consumables
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
      • Guides
      • Setup
    • Smoking
      • Resource Description
      • Config
      • Exports & Events
      • Examples
      • Dependencies
      • Changelog
      • Test Server
      • Setup
    • Garages
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
      • Setup
      • Common Issues
    • Drugdealer
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Crafting
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Plants
      • Resource Description
      • Config
      • Exports & Events
      • Dependencies
      • Changelog
    • Mugging
      • Resource Description
      • Config
      • Exports & Events
      • Changelog
    • Gangsystem
      • Resource Description
      • Config
      • Exports & Events
      • Examples
      • Dependencies
      • Changelog
  • Free Resources
    • Zyke Lib
      • Resource Description
      • Dependencies
      • Config
      • Setup
    • Status
      • Resource Description
      • Dependencies
      • Changelog
      • Setup
    • Propaligner
      • Resource Description
      • Exports & Events
      • Dependencies
      • Changelog
    • Vending Machines
      • Resource Description
      • Dependencies
      • Changelog
    • Sounds
      • Resource Description
      • Exports & Events
    • Key Minigame
      • Resource Description
      • Exports & Events
      • Changelog
    • Stabwheels
      • Resource Description
      • Dependencies
      • Changelog
    • Burncars
      • Resource Description
      • Dependencies
      • Changelog
    • Catalytic
      • Resource Description
      • Exports & Events
      • Config
      • Dependencies
      • Changelog
Powered by GitBook
On this page
  • Client Exports
  • Is Current Empty
  • Has Item Equipped
  • Is Occupied
  • Get Equipped Item Metadata
  • Force Item Unequip
  • Client Events
  • Personal Setting Changed
  • World Item Created
  • World Item Removed
  • Server Exports
  • Is Current Empty
  • Has Item Equipped
  • Is Occupied
  • Get Equipped Item Metadata
  • Force Item Unequip
  • Add To Current Item
  • Give Ingredient
  • Add Item
  • Craft Item

Was this helpful?

  1. Paid Resources
  2. Consumables

Exports & Events

All exports and events available to integrate this resource into others.

Types & Classes

All types & classes can be found in types.lua.

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.

Client Exports

Is Current Empty

Returns if the current item you are holding is empty or not. Will also return false if you are not holding any item. Example:

---@return boolean
local isEmpty = exports["zyke_consumables"]:IsCurrentItemEmpty()

Has Item Equipped

Returns if you currently have an item. Example:

---@return boolean
local hasItem = exports["zyke_consumables"]:HasItemEquipped()

Is Occupied

Returns if you are currently occupied with any action within our script. Placement, consuming, grabbing item etc. If you are using the script and not idling it, you are most likely labeled as occupied. If you are ever struggling with this, you can enable debug mode and it will explicitly tell you what is making you occupied. Example:

---@return boolean
local isOccupied = exports["zyke_consumables"]:IsOccupied()

Get Equipped Item Metadata

Returns the cached metadata for the item you have equipped. You can find guaranteed values in zyke_consumables/types.lua, along with all of the metadata that already existed on the item before you equipped it. Example:

---@return table | nil
local metadata = exports["zyke_consumables"]:GetCurrentMetadata()

Force Item Unequip

Forcefully unequips your item into your inventory if you have one equipped. Still performs the interaction animations & delays. This does wait for all of the interactions to finish before before you can proceed. This will skip the check for the setting autoPourDrinkOnGround and automatically do it if needed. Example:

exports["zyke_consumables"]:ForceUnequip()

Client Events

Personal Setting Changed

When you change any of your personal settings, this is triggered. Example:

---@param setting string
---@param value string | boolean
RegisterNetEvent("zyke_consumables:OnPersonalSettingChanged", function(setting, value)
    -- Perform any action in here
end)

World Item Created

When someone places an item, this is triggered. It does not track if you are in render, this will trigger for all world items on creation. Example:

---@param activeItemId string
---@param data table
RegisterNetEvent("zyke_consumables:WorldItemCreated", function(activeItemId, data)
    -- Perform any action in here
end)

World Item Removed

When someone removes an item, this is triggered. It does not track if you are in render, this will trigger for all world items on removal. Example:

---@param activeItemId string
---@param netId integer
RegisterNetEvent("zyke_consumables:WorldItemRemoved", function(activeItemId, netId)
    -- Perform any action in here
end)

Server Exports

Is Current Empty

Returns if the current item you are holding is empty or not. Will also return false if you are not holding any item. Example:

---@param plyId integer
---@return boolean
local isEmpty = exports["zyke_consumables"]:IsCurrentItemEmpty(plyId)

Has Item Equipped

Returns if you currently have an item. Example:

---@param plyId integer
---@return boolean
local hasItem = exports["zyke_consumables"]:HasItemEquipped(plyId)

Is Occupied

Returns if you are currently occupied with any action within our script. Placement, consuming, grabbing item etc. If you are using the script and not idling it, you are most likely labeled as occupied. If you are ever struggling with this, you can enable debug mode and it will explicitly tell you what is making you occupied. Example:

---@param plyId integer
---@return boolean
local isOccupied = exports["zyke_consumables"]:IsOccupied(plyId)

Get Equipped Item Metadata

Returns the cached metadata for the item you have equipped. You can find guaranteed values in zyke_consumables/types.lua, along with all of the metadata that already existed on the item before. Example:

---@param plyId integer
---@return table | nil
local metadata = exports["zyke_consumables"]:GetCurrentMetadata(plyId)

Force Item Unequip

Forcefully unequips your item into your inventory if you have one equipped. Still performs the interaction animations & delays. This does wait for all of the interactions to finish before before you can proceed. This will skip the check for the setting autoPourDrinkOnGround and automatically do it if needed. Example:

---@param plyId integer
exports["zyke_consumables"]:ForceUnequip(plyId)

Add To Current Item

Add amount to the current item of the target. This is limited to direct consumption-reward items. Example:

---@param plyId integer
---@param amount number
---@param valueType? "amount" | "percentage" @Default "amount"
---@return boolean
local success = exports["zyke_consumables"]:AddToCurrentItem(plyId, amount, valueType)

Give Ingredient

Gives an ingredient, and allows you to configure the metadata easily in one go. Example:

---@param plyId integer
---@param name string @Item name
---@param amount? integer @Default 1
---@param quality? number @Default 100.0
exports["zyke_consumables"]:GiveIngredient(plyId, name, amount, quality)

Add Item

Gives a consumable item. This export will be replaced with specifics for consumption-reward-based & ingredient-based. Example:

---@param plyId integer
---@param itemIdentifier string @item id in settings or item name
---@param amount? integer @Default 1
---@param activeItemId? string @If the metadata is currently cached, most likely won't use this
---@param metadataIngredients? MetadataIngredient[] @If item is ingredient-based, pass in the ingredients you want, see types.lua
---@param quality? number @If item is direct consumption rewards, this is the quality
exports["zyke_consumables"]:AddItem(plyId, itemIdentifier, amount, activeItemId, metadataIngredients, quality)

Craft Item

Crafts an ingredient-based consumable item. Do keep in mind that the ingredients you input will be added on top of the base ingredient configuration. Example:

---@param plyId integer
---@param itemIdentifier string @item id or item name
---@param ingredients? MetadataIngredient[] | {name: string, quality: number}[] @If none provided, it will just have the base items
---@param requireIngredients? boolean @If enabled, it will check & require the items, along with removing them
---@return boolean
local success = exports["zyke_consumables"]:CraftItem(plyId, itemIdentifier, ingredients, requireIngredients)
PreviousConfigNextDependencies

Last updated 11 days ago

Was this helpful?