Skip to content

Commit 4fde584

Browse files
committed
Init Events
1 parent 5b472c1 commit 4fde584

11 files changed

Lines changed: 373 additions & 0 deletions
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
description: Trigger to close the inventory
3+
sidebar_position: 3
4+
---
5+
6+
# inventory:closeInventory
7+
8+
You can also add a reason but this is optional.
9+
```lua
10+
TriggerEvent('inventory:closeInventory', reason)
11+
```
12+
13+
### Clientside
14+
```lua
15+
TriggerEvent('inventory:closeInventory', "This is a reason Notify")
16+
```
17+
18+
### Serverside
19+
```lua
20+
TriggerClientEvent('inventory:closeInventory', source, "This is a reason Notify")
21+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
description: With this Event you can Lock the inventory to be opened again
3+
sidebar_position: 4
4+
---
5+
6+
# inventory:lock
7+
8+
<span style={{color: 'red'}}>**Parameters**</span>\
9+
**lock** - `boolean` - `(true / false)`
10+
11+
```lua
12+
TriggerEvent('inventory:lock', lock)
13+
```
14+
15+
### Clientside
16+
```lua
17+
TriggerEvent('inventory:lock', true)
18+
```
19+
20+
### Serverside
21+
```lua
22+
TriggerClientEvent('inventory:lock', source, true)
23+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
description: With this Event you can Lock the inventory to be opened again for X seconds.
3+
sidebar_position: 5
4+
---
5+
6+
# inventory:lockInventory
7+
8+
You can also add a reason but this is optional.
9+
10+
```lua
11+
TriggerEvent('inventory:lockInventory', miliseconds)
12+
```
13+
14+
This example will lock the inventory for 1 second.
15+
16+
### Clientside
17+
```lua
18+
TriggerEvent('inventory:lockInventory', 1000)
19+
```
20+
21+
### Serverside
22+
```lua
23+
TriggerClientEvent('inventory:lockInventory', source, 1000)
24+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
description: Notify the player with the inventory notification system
3+
sidebar_position: 1
4+
---
5+
6+
# inventory:notify
7+
8+
<span style={{color: 'red'}}>**Parameters**</span>\
9+
**message** - `string` - The message you want to send\
10+
**type** - `string` - There are 3 types `("info", "error", "success")`
11+
12+
### Clientside
13+
```lua
14+
TriggerEvent("inventory:notify", "Hello FiveM!", "success")
15+
```
16+
17+
### Serverside
18+
```lua
19+
TriggerClientEvent('inventory:notify', source, "Hello FiveM!", "success")
20+
```
21+
22+
## inventory:openInventory
23+
24+
This opens the own player inventory:
25+
```lua
26+
TriggerEvent('inventory:openInventory')
27+
```
28+
29+
This opens a secondary inventory:
30+
```lua
31+
TriggerEvent('inventory:openInventory', {
32+
type = "stash", -- "type" in database
33+
id = "1", -- "identifier" in database
34+
title = "Chezza's Stash",
35+
weight = 100, -- set to false for no weight,
36+
delay = 100,
37+
save = true -- save to database true or false
38+
})
39+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
description: Open the crafting inventory from a different script
3+
sidebar_position: 8
4+
---
5+
6+
# inventory:openCrafting
7+
8+
:::info
9+
clientside AND serverside
10+
:::
11+
12+
:::warning
13+
`Config.Crafting` must be set to `true`
14+
:::
15+
16+
<span style={{color: 'red'}}>**Parameters**</span>\
17+
**title** - `string` - Title of the crafting inventory\
18+
**items** - `array` - See below (Items Object)
19+
20+
<span style={{color: 'yellow'}}>**Parameters (Items Object)**</span>\
21+
**type** - `string` - `item` or `weapon`\
22+
**name** - `string` - Name of the item\
23+
**count** - `number` - How many items you get after crafting\
24+
**time** - `number` - How long does it take to craft the specified item\
25+
**ingredients** - `array` - This are the items that you need to craft the specified item
26+
27+
### Example
28+
29+
```lua
30+
local items = {
31+
{type = 'item', name = 'fishrod', count = 1, time = 5, ingredients = {
32+
{name = 'stick', count = 1},
33+
{name = 'hook', count = 1}
34+
}},
35+
-- copy and paste the table above in here for multiple items at this position
36+
}
37+
```
38+
39+
### Clientside
40+
```lua
41+
TriggerEvent("inventory:openCrafting", title, items)
42+
```
43+
44+
### Serverside
45+
You can use this:
46+
```lua
47+
TriggerClientEvent("inventory:openCrafting", source, title, items)
48+
```
49+
or you can use this:
50+
```lua
51+
xPlayer.triggerEvent("inventory:openCrafting", title, items)
52+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
description: Open the house inventory from a different script
3+
sidebar_position: 11
4+
---
5+
6+
# inventory:openHouse
7+
8+
:::info
9+
clientside AND serverside
10+
:::
11+
12+
<span style={{color: 'red'}}>**Parameters**</span>\
13+
**owner** - `string` - Owner of house (identifier)\
14+
**id** - `string` - ID of house\
15+
**title** - `string` - Title of the house\
16+
**weight** - `number` - Weight of the house
17+
18+
```lua
19+
TriggerEvent('inventory:openHouse', "steam:id", "house-1", "House Title", 300)
20+
```
21+
22+
### Clientside
23+
```lua
24+
TriggerEvent('inventory:openHouse', ESX.GetPlayerData().identifier, "house-1", "House Title", 300)
25+
```
26+
27+
### Serverside
28+
You can use this:
29+
```lua
30+
TriggerClientEvent('inventory:openHouse', source, xPlayer.identifier, "house-1", "House Title", 300)
31+
```
32+
or you can use this:
33+
```lua
34+
xPlayer.triggerEvent("inventory:openShop", xPlayer.identifier, "house-1", "House Title", 300)
35+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
description: Trigger to open the inventory
3+
sidebar_position: 2
4+
---
5+
6+
# inventory:openInventory
7+
8+
This opens the own player inventory:
9+
10+
```lua
11+
TriggerEvent('inventory:openInventory')
12+
```
13+
14+
This opens a secondary inventory:
15+
16+
```lua
17+
TriggerEvent('inventory:openInventory', {
18+
type = "stash", -- "type" in database
19+
id = "1", -- "identifier" in database
20+
title = "Chezza's Stash",
21+
weight = 100, -- set to false for no weight,
22+
delay = 100,
23+
save = true -- save to database true or false
24+
})
25+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
description: Open a players inventory
3+
sidebar_position: 6
4+
---
5+
6+
# inventory:openPlayerInventory
7+
8+
:::info
9+
clientside AND serverside
10+
:::
11+
12+
<span style={{color: 'red'}}>**Parameters**</span>\
13+
**playerId** - `number` - This should be the playerId\
14+
**receiveWeapons** - `boolean` - `true` or`false`
15+
16+
### Clientside
17+
```lua
18+
TriggerEvent("inventory:openPlayerInventory", playerId, receiveWeapons)
19+
```
20+
21+
**Example:**
22+
```lua
23+
local player, distance = ESX.Game.GetClosestPlayer()
24+
if player ~= -1 and distance <= 3.0 then
25+
TriggerEvent('inventory:openPlayerInventory', GetPlayerServerId(player), true)
26+
end
27+
```
28+
29+
### Serverside
30+
```lua
31+
TriggerClientEvent("inventory:openPlayerInventory", source, playerId, receiveWeapons)
32+
```
33+
34+
**Example:**
35+
36+
You can use this:
37+
```lua
38+
TriggerClientEvent("inventory:openPlayerInventory", source, xPlayer.source, true)
39+
```
40+
41+
or you can use this:
42+
```lua
43+
xPlayer.triggerEvent("inventory:openPlayerInventory", xPlayer.source, true)
44+
```
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
description: Open the shop inventory from a different script
3+
sidebar_position: 9
4+
---
5+
6+
# inventory:openShop
7+
8+
:::info
9+
clientside AND serverside
10+
:::
11+
12+
:::warning
13+
`Config.Shops` must be set to `true`
14+
:::
15+
16+
<span style={{color: 'red'}}>**Parameters**</span>\
17+
**title** - `string` - Title of the shop\
18+
**items** - `array` - See below (Items Object)
19+
20+
<span style={{color: 'yellow'}}>**Parameters (Item Object)**</span>\
21+
**type** - `string` - `item` or `weapon`\
22+
**name** - `string` - Name of the item\
23+
**method** - `string` - `money`, `bank` or `black_money`\
24+
**price** - `number` or `boolean` - Set false to disable buying\
25+
**sellPrice** - `number` or `boolean` - Set false to disable selling
26+
27+
```lua
28+
local items = {
29+
{type = 'item', name = 'apple', method = 'money', price = 10, sellPrice = 3},
30+
{type = 'item', name = 'strawberry', method = 'bank', price = false, sellPrice = 3},
31+
{type = 'item', name = 'cherry', method = 'black_money', price = 10, sellPrice = false},
32+
}
33+
```
34+
35+
### Clientside
36+
37+
```lua
38+
TriggerEvent("inventory:openShop", title, items)
39+
```
40+
41+
### Serverside
42+
You can use this:
43+
```lua
44+
TriggerClientEvent("inventory:openShop", source, title, items)
45+
```
46+
or you can use this:
47+
```lua
48+
xPlayer.triggerEvent("inventory:openShop", title, items)
49+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
description: Open the storage inventory from a different script
3+
sidebar_position: 10
4+
---
5+
6+
# inventory:openStorage
7+
8+
:::info
9+
clientside AND serverside
10+
:::
11+
12+
<span style={{color: 'red'}}>**Parameters**</span>\
13+
**title** - `string` - Title of the storage container\
14+
**id** - `string` - Unique id for the the storage container\
15+
**weight** - `number` - Weight of the storage container\
16+
**delay** - `number` - Open delay for the container\
17+
**jobs** - `array` or `string` - Array of jobs that are allowed to access the container
18+
19+
### Clientside
20+
```lua
21+
TriggerEvent('inventory:openStorage', "Locker", "locker-1", 100, 1000, {"police", "ambulance"})
22+
```
23+
24+
### Serverside
25+
You can use this:
26+
```lua
27+
TriggerClientEvent('inventory:openStorage', source, "Locker", "locker-1", 100, 1000, {"police", "ambulance"})
28+
```
29+
or you can use this:
30+
```lua
31+
xPlayer.triggerEvent("inventory:openShop", "Locker", "locker-1", 100, 1000, {"police", "ambulance"})
32+
```

0 commit comments

Comments
 (0)