Crates & Storages
Exports
All client- & serversided exports included within this script. Exports provide callable functions that allow other resources to interact with this script's functionality.
If additional exports are required for your implementation, please submit a formal request through our ticketing system on the official Discord server.
Server Exports
CreateCrate
Creates a crate.
exports['RxZ_Crates']:CreateCrate(crate)
crate
table required
Data about the crate to create.
Example
local id = exports['RxZ_Crates']:CreateCrate({
label = 'Ammo Crate',
prop = "crateammo",
coords = vector4(3044.5684, -4713.0161, 15.2613, 195.6455),
slots = 12,
contents = {
itemsAmount = math.random(3, 6),
lootables = { -- Make sure all chances add up to 100
{ item = 'ammo-rifle2', amount = math.random(20, 50), chance = 25 },
{ item = 'ammo-shotgun', amount = math.random(20, 50), chance = 25 },
{ item = 'ammo-9', amount = math.random(20, 50), chance = 25 },
{ item = 'ammo-musket', amount = math.random(20, 50), chance = 25 },
}
},
-- THESE ARE OPTIONAL, THEY HAVE DEFAULTS WHEN U REMOVE THEM
respawnTime = 1, -- Minutes, set to false to disable respawn
icon = "fas fa-box-open", -- https://fontawesome.com/icons
iconColor = "#ff0000",
hacking = {
enabled = true,
time = 1, -- Minutes
minigame = true,
item = 'bluekeycard', -- Set to false to disable
},
})
Client Exports
OpenStorage
Opens a storage for the player.
exports['RxZ_Crates']:OpenStorage(key, label, slotsAmount)
key
number required
Unique identifier of the storage to open.
label
number
Label of the storage to open.
slotsAmount
number
Number of slots in the storage to open. If not provided, it will use the default amount of slots defined in the crate.