-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathserver.lua
More file actions
62 lines (48 loc) · 1.67 KB
/
Copy pathserver.lua
File metadata and controls
62 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
local inventory <const> = exports.ox_inventory
local items <const> = inventory:Items()
RegisterNetEvent('ox:creativechest', function()
local player <const> = Player(source).state
if not (Config.groups[player.group]) then return print("Vous devez être admin.") end
inventory:RegisterStash('creativechest', Config.NameCreativeMenu, Config.MaxSlotsCreativeMenu, Config.MaxWeight, true)
for _, item in pairs(items) do
inventory:AddItem('creativechest', item.label, item.amount, item.data)
end
end)
RegisterCommand("creativechest", function(source, args, rawCommand)
local src = source
local inventoryResource = exports["ox_inventory"]
if not inventoryResource then
print("ox_inventory resource not found.")
return
end
local items = {}
for _, item in pairs(inventoryResource:Items()) do
table.insert(items, { item.name, 1, {} })
end
local id = inventoryResource:CreateTemporaryStash({
label = "Creative Inventory",
slots = 1000,
maxWeight = 500000000000000000,
owner = true,
items = items
})
TriggerClientEvent('ox_inventory:openInventory', src, 'creative', id)
end)
RegisterCommand("stash", function(source, args, rawCommand)
local src = source
print("Executing stash command...")
local inventoryResource = exports["ox_inventory"]
if not inventoryResource then
print("ox_inventory resource not found.")
return
end
-- Create a temporary stash
local id = inventoryResource:CreateTemporaryStash({
label = "Stash",
slots = 1000,
maxWeight = 500000000000000000,
owner = true,
items = items
})
TriggerClientEvent('ox_inventory:openInventory', src, 'stash', id)
end)