update creating items guide information

This commit is contained in:
Luke committed 2022-11-16 21:33:44 +01:00
1 parent 01c73f6fe3
commit e641798c36
1 file changed
+63 -72
+63 -72
View File
@@ -14,54 +14,58 @@ Key is the name (not the label) of an item and the value is a table containing t
options for the item. options for the item.
**Item options:** **Item options:**
<Tabs>
<TabItem value='shared' label='Shared'>
```lua * label: `string`
-- label: string * weight?: `number`
-- weight: number (optional) * stack?: `boolean`
-- stack: boolean (optional) -- If set to false will not allow the item to be stacked * If set to false will not allow the item to be stacked.
-- degrade: number (optional) -- The amount of time in minutes an item will degrade after * degrade?: `number`
-- close: boolean (optional) -- If set to false will not close the inventory on item use * Amount of time in minutes the item will degrade after.
-- description: string (optional) * close?: `boolean`
-- consume: number (optional) -- Item count needed, and removed, on use. (Default: 1) Set to a decimal for durability loss (0.2 = 20%) * If set to false does not close the inventory on item use.
-- allowArmed: boolean (optional) -- If set to true will allow use of item while armed with a weapon * description?: `string`
-- client: table (optional) * Item description that will be shown in the tooltip
-- buttons: table (optional) -- Allows you to define custom context menu functions for the item * consume?: `number`
``` * Item count needed and removed use.
* Default: 1
</TabItem> * If set to a decimal will consume durability instead (0.2 = 20%).
<TabItem value='client' label='Client'> * allowArmed?: `boolean`
* If set to true will allow use of item while armed with a weapon.
All values are optional. * client?: `table`
* export?: `string`
```lua * Export to be triggered after item use.
-- event: string -- Event to trigger after item use * event?: `string`
-- status: table -- Adjust esx_status values after use * Event to be triggered after item use.
-- anim: table -- Animation during progress bar * status?: `table`
-- dict: string * Adjust esx_status values after use.
-- clip: string * anim?: `table`
-- prop: table -- Attached prop during progress bar * Animation that will be played during the progress bar.
-- model: string or hash * dict: `string`
-- pos: table (x, y, z) * clip: `string`
-- rot: table (x, y, z) * prop?: `table`
-- disable: boolean -- Disables actions during progress bar * Attached prop that will be displayed during the progress bar.
-- usetime: number * model: `string` or `hash`
-- cancel: boolean -- If set to true the player can cancel item use * pos: `table` (x, y, z)
-- add: function(total) -- Function that triggers when recieving an item (Returns total item count as `total`) * rot: `table` (x, y, z)
-- remove: function(total) -- Function that triggers when removing an item (Returns total item count as `total`) * disable?: `table`
``` * Actions to be disabled during the progress bar
* move?: `boolean`
</TabItem> * car?: `boolean`
<TabItem value='buttons' label='Buttons'> * combat?: `boolean`
* mouse?: `boolean`
```lua * usetime?: `number`
-- label: string, * cancel?: `boolean`
-- action: function(slot) -- Callback function when button is clicked in context menu, returns item slot * If set to true the player canc cancel item use.
``` * add?: `function`(total: `number`)
* Function that triggers when recieving an item
</TabItem> * Returns total item count as `total`
</Tabs> * remove?: `function`(total: `number`)
* Function that triggers when removing an item
* Returns total item count as `total`
* buttons?: `table`
* label: `string`
* action: `function`(slot: `number`)
* Callback function when button is clicked in context menu, returns item slot.
**Examples:** **Examples:**
<Tabs> <Tabs>
@@ -87,11 +91,9 @@ All values are optional.
``` ```
</TabItem> </TabItem>
<TabItem value='custom_burger' label='Custom burger'> <TabItem value='description_burger' label='Description burger'>
A modified burger item, with a description and custom crafting table. A modified burger item which includes a description.
Combined with several new functions and events you could easily create your own crafting system.
```lua ```lua
['burger'] = { ['burger'] = {
@@ -110,16 +112,6 @@ Combined with several new functions and events you could easily create your own
}, },
usetime = 2500, usetime = 2500,
} }
crafting = {
['bun'] = 2,
['ketchup'] = 1,
['mustard'] = 1,
['cheese'] = 1,
['pickles'] = 1,
['lettuce'] = 1,
['tomato'] = 1,
['onion'] = 1,
}
} }
``` ```
@@ -249,17 +241,16 @@ When registered you can define the item as a container under the `Items.containe
The key for the container is the `name` you gave it when registering the item. The key for the container is the `name` you gave it when registering the item.
You can also define the number of slots, the maximum weight, blacklist and whitelist items. You can also define the number of slots, the maximum weight, blacklist and whitelist items.
```lua * itemName: `table`
['name'] = { * size: `{number, number}`
-- size: {slots, maxWeight} * First index is number of slots the container will have.
-- slots: number * Second index is the maximum weight of the container.
-- maxWeight: number * blacklist: `table`
-- blacklist: table (optional) * Key-value pairs of item name and true
-- ['itemName'] = true * `['itemName'] = true`
-- whitelist: table (optional) * whitelist: `table`
-- ['itemName'] = true * Key-value pairs of item name and true
} * `['itemName'] = true`
```
**Example:** **Example:**