Zea Development - Documentation
StoreWebsiteDiscord
  • Welcome
  • General
    • Downloading Resources
    • Transferring Resources
    • Resource Support
    • Escrow Errors
  • Our Resources
    • z_hose
      • Resource Configuration
        • Configuration Modules
      • Compatibility with ox_inventory
      • Resource Usage
      • Developer Resources
        • Client Exports
        • Server Exports
    • z_boot (Coming Soon!)
      • Resource Configuration
        • Configuration Modules
        • Item Creation
      • Developer Resources
        • Client Exports
    • z_els
      • Resource Configuration
      • Resource Usage
      • Developer Exports
      • Creating Patterns
      • Directional Types
    • z_fires
      • Resource Configuration
      • JSON Configuration
      • Resource Usage
      • Developer Exports
      • Materials List
    • z_ppvfan
      • Resource Configuration
      • Resource Usage
    • zTurnout-System
      • Resource Configuration
      • Resource Usage
      • Trigger Events
    • zWigWags
      • Resource Configuration
      • Resource Usage
      • Trigger Events
    • zFire-Alarm
      • Resource Configuration
      • Resource Usage
    • z9m-Ladder
      • Resource Configuration
      • Resource Usage
    • z105m-Ladder
      • Resource Configuration
      • Resource Usage
    • z135m-Ladder
      • Resource Configuration
      • Resource Usage
    • zCustody-Alarm
      • Resource Configuration
      • Resource Usage
    • zFire-Pole
      • Resource Configuration
      • Resource Usage
    • zTurnout-Rack
      • Resource Configuration
      • Resource Usage
    • zPager
      • Resource Configuration
      • Resource Usage
    • zTurnouts
      • Resource Configuration
      • Resource Usage
Powered by GitBook
On this page
  1. Our Resources
  2. z_boot (Coming Soon!)
  3. Resource Configuration

Item Creation

This page will outline and explain how to create and customize items within the script.

Creating a new item

1

Navigate to the items file

Please navigate to the items file within the resource, which can be found at the following path. settings > items.lua

2

Create a new section

Now that you are in the appropriate location, please proceed to create a new section in your specified category. These categories are purely for organizational purposes. Your resource will not break if you do not follow the categories.

Once you have selected a place to create your new section, please copy and paste the following:

['Example Name'] = {
    itemImage = 'example_image.png',
    takeMultiple = true,

    ---@param count integer
    ---@param itemName string
    ---@param parentId integer
    ---@return boolean
    takeFunction = function(count, itemName, parentId)
        local PROP_HASH = `example_prop_name`

        return object.spooner(PROP_HASH, count, itemName, parentId)
    end,
    ---@param itemName string
    ---@param parentId integer
    ---@return boolean
    returnFunction = function(itemName, parentId)
        return object.store(itemName, parentId)
    end,
},
3

Naming your item

You now have a new section or item that requires a unique name. The name of the item is determined by the string you input into the starting square brackets. By default, this will be set to 'Example Name.'

['My Item'] = {}
4

Assigning an icon to your item

You must now assign an icon to your item. This icon should accurately reflect the name and purpose of the item itself. You can assign an icon by inputting a string into the itemImagevariable. This string must correspond to a valid image located within the settings > icons folder. Please ensure that the string also includes the appropriate file extension, such as .png or .jpg.

itemImage = 'image.png',
5

Creating a take function for your item

Each item necessitates a take function. The content of this function will be executed when you collect the item from a vehicle's boot. This function can include any logic, provided that it returns a boolean value indicating whether the action was successful or not.

By default, z_boot offers four types of item functions, which are designed for object spawning, clothing management, weapon management, and command execution. Further details regarding these functions can be found later on this page.

The rationale behind enabling server owners to customize their functions is to facilitate the incorporation of their own custom functions and to ensure seamless integration with other resources.

Provided below is the template for the take function

---@param count integer
---@param itemName string
---@param parentId integer
---@return boolean
takeFunction = function(count, itemName, parentId)
    return true
end
6

Creating a return function for your item

Just as each item requires a take function, they also necessitate a return function. This function manages the action of placing an item back into a vehicle inventory. It can implement any logic, provided it returns a boolean value indicating whether the action was successful. By default z_boot offers various default examples of this function, which will be explained further later in this document.

Provided below is the template for the return function

---@param itemName string
---@param parentId integer
---@return boolean
returnFunction = function(itemName, parentId)
    return true
end

Default item functionality

Each item requires you to create its unique functionality, z_boot offer multipe default functionalities you can easily copy and paste and made addition too without requiring knowledge of coding, These are all below and are explained.

Command Execution is one of the most straightforward functionalities available. This feature allows a command to be triggered by the resource, which doesnt require user input via chat. For instance, if you have a command that provides the player with spiketrips, you can execute this command using this functionality.

Please be aware that you do not need to use a /to initiate the command; you only need to enter the command name itself.

---@return boolean
takeFunction = function()
    local isSuccess = true
        ExecuteCommand('YOUR_COMMAND')
    return isSuccess
end,
---@return boolean
returnFunction = function()
    local isSuccess = true
        ExecuteCommand('YOUR_COMMAND')
    return isSuccess
end

The object spawning functionality allows for the taking of objects from the vehicle and their placement on the ground using the built-in object spooner system. This function includes one configurable option, which is the prop name. Please ensure that the prop name is enclosed in backticks to convert it to a hashkey.

---@param count integer
---@param itemName string
---@param parentId integer
---@return boolean
takeFunction = function(count, itemName, parentId)
    local PROP_HASH = `prop_roadcone02a`

    return object.spooner(PROP_HASH, count, itemName, parentId)
end,
---@param itemName string
---@param parentId integer
---@return boolean
returnFunction = function(itemName, parentId)
    return object.store(itemName, parentId)
end,

The weapon management functionality enables users to collect and return weapons from vehicles. These weapons may include specified attachments and ammunition counts.

This functionality offers multiple configurable options. The first option is the weapon name, which should be enclosed in backticks to convert it to a hash key. The second option is the ammunition count, represented by an integer value. The third configurable option pertains to weapon attachments; this is a table that can contain various strings, although it may remain empty if no attachments are desired.

---@param itemName string
---@return boolean
takeFunction = function(itemName)
    local WEAPON_HASH = `WEAPON_CARBINERIFLE`
    local WEAPON_AMMO = 120
    local WEAPON_ATTACHMENTS = {
        'COMPONENT_AT_SCOPE_MEDIUM',
        'COMPONENT_AT_AR_SUPP',
        'COMPONENT_AT_AR_AFGRIP',
    }

    return Init.functions.weaponHandler(WEAPON_HASH, WEAPON_AMMO, WEAPON_ATTACHMENTS, itemName, 'give')
end,
---@param itemName string
---@return boolean
returnFunction = function(itemName)
    local WEAPON_HASH = `WEAPON_CARBINERIFLE`
    local WEAPON_AMMO = 0
    local WEAPON_ATTACHMENTS = {}

    return Init.functions.weaponHandler(WEAPON_HASH, WEAPON_AMMO, WEAPON_ATTACHMENTS, itemName, 'take')
end,

The clothing management functionality enables users to collect and return clothing items from a vehicle's boot. This function includes multiple configurable parameters. The first parameter is the clothing category, the second is the drawable index, and the third is the texture index. The clothing categories can be found in the following location: core > client > classes > enums.lua > enums.animations

---@param itemName string
---@return boolean
takeFunction = function(itemName)
    local CLOTHNG_CATERGORY = 'body_armor'
    local CLOTHING_DRAWABLE = 85
    local CLOTHING_TEXTURE = 1

    return Init.functions.eupHandler(CLOTHNG_CATERGORY, CLOTHING_DRAWABLE, CLOTHING_TEXTURE, itemName, 'give')
end,
---@param itemName string
---@return boolean
returnFunction = function(itemName)
    local CLOTHNG_CATERGORY = 'body_armor'
    local CLOTHING_DRAWABLE = 85
    local CLOTHING_TEXTURE = 1

    return Init.functions.eupHandler(CLOTHNG_CATERGORY, CLOTHING_DRAWABLE, CLOTHING_TEXTURE, itemName, 'take')
end,

PreviousConfiguration ModulesNextDeveloper Resources

Last updated 1 month ago

Provided is the attachment names to input into the table if you wish to use them.

here
Page cover image