☰ All guides
6-case
Case opening like in CS: unlimited cases, six rarity grades, items, weapons, money and vehicles as rewards.
Resource folder
six_case
01Requirements
- ESX (1.1, 1.2 or Legacy) or QB-Core
oxmysqlormysql-async. The manifest loads@mysql-async/lib/MySQL.lua, which oxmysql provides as well.- An inventory whose item icons are PNG files.
02Installation
- 01Sign in to the Cfx Portal with the account you bought with and download the script under Granted Assets.
- 02Unzip the download and move the folder
six_caseinto theresourcesfolder of your server. Keep the folder name and upload every file, including the hidden.fxap. - 03Create one item per case. The item name is the key in
Config.Casesystem, by defaultcase. - 04Open
config.lua, setConfig.frameworkand pointConfig.PathInventoryto the icon folder of your inventory. - 05For Discord logs: open
config_server.lua, enter your own webhook link and setenable = true. - 06Add
ensure six_caseto yourserver.cfg, below your framework andoxmysql. - 07Restart the server (or run
refreshand thenensurewith the folder name in the server console).
INSERT INTO items (name, label) VALUES ('case', 'Case');
case = { name = 'case', label = 'Case', weight = 100, type = 'item', image = 'case.png', unique = false, useable = true, shouldClose = true, description = 'Open it and see what you get' },
Good to know
ox_inventory: items are not read from the database. Add the item to ox_inventory/data/items.lua instead: ['case'] = { label = 'Case', weight = 100 },
03How it works
A player uses the case item. The opening animation runs, the script first rolls a grade by winrate and then picks a random reward from that grade. One case is removed per opening.
04Configuration
Option
- Config.framework
"esx"or"qb".- Config.newESX
truefor ESX Legacy (1.2 and newer, shared object via export).falsefor old ESX 1.1 (shared object via event). Ignored on QB.- Config.Language
"en"or"de"(texts of the Discord log).- Config.PathInventory
- NUI path to your inventory icons, for example
nui://ox_inventory/web/images/. The picture shown for a reward isitem_name+.pngfrom that folder. - Config.Casesystem
- One block per case. The key is the item name. Copy the block to add more cases.
- winrate
- Chance per grade in percent. The six values must add up to 100.
- caseitems
- Rewards per grade. Every entry has
type,item_name,countandlabel.
Reward type
- item
item_nameis the item,countthe amount.- weapon
item_nameis the weapon name, for exampleweapon_pistol50.- money
item_nameis the account (money,bank,black_money),countthe amount.- car
item_nameis the spawn name. The vehicle is written toowned_vehicles(ESX) orplayer_vehicles(QB) with a new plate.
›config.luaComplete file · 83 lines
Config = {}
Config.framework = "esx" -- esx or qb
Config.newESX = true
Config.Language = "en"
-- Enter here your inventory icon path
Config.PathInventory = "nui://inventory/web/assets/icons/" -- supports only png pictures
Config.Casesystem = {
["case"] = { -- Case item name
winrate = {
{grade = "Industrial", rate = 40.0}, -- 40% chance
{grade = "Mil-Spec", rate = 40.0}, -- 40% chance
{grade = "Restricted", rate = 16.0}, -- 16% chance
{grade = "Classified", rate = 3.05}, -- 3.05% chance
{grade = "Covert", rate = 0.85}, -- 0.85% chance
{grade = "Extraordinary", rate = 0.1} -- 0.1% chance (It's enought and player will hit it, but they need patient)
},
caseitems = {
-- types: item, weapon, money
["Industrial"] = {
{type = "item", item_name = "sandwich", count = 1, label = "sandwich"},
{type = "weapon", item_name = "weapon_pistol50", count = 1, label = "Pistol .50"},
{type = "car", item_name = "t20", count = 1, label = "T20"},
{type = "money", item_name = "bank", count = 20000, label = "20k Money"},
},
["Mil-Spec"] = {
{type = "item", item_name = "sandwich", count = 1, label = "sandwich"},
{type = "weapon", item_name = "weapon_pistol50", count = 1, label = "Pistol .50"},
{type = "car", item_name = "t20", count = 1, label = "T20"},
{type = "money", item_name = "bank", count = 20000, label = "20k Money"},
},
["Restricted"] = {
{type = "item", item_name = "sandwich", count = 1, label = "sandwich"},
{type = "weapon", item_name = "weapon_pistol50", count = 1, label = "Pistol .50"},
{type = "car", item_name = "t20", count = 1, label = "T20"},
{type = "money", item_name = "bank", count = 20000, label = "20k Money"},
},
["Classified"] = {
{type = "item", item_name = "sandwich", count = 1, label = "sandwich"},
{type = "weapon", item_name = "weapon_pistol50", count = 1, label = "Pistol .50"},
{type = "car", item_name = "t20", count = 1, label = "T20"},
{type = "money", item_name = "bank", count = 20000, label = "20k Money"},
},
["Covert"] = {
{type = "item", item_name = "sandwich", count = 1, label = "sandwich"},
{type = "weapon", item_name = "weapon_pistol50", count = 1, label = "Pistol .50"},
{type = "car", item_name = "t20", count = 1, label = "T20"},
{type = "money", item_name = "bank", count = 20000, label = "20k Money"},
},
["Extraordinary"] = {
{type = "item", item_name = "sandwich", count = 1, label = "sandwich"},
{type = "weapon", item_name = "weapon_pistol50", count = 1, label = "Pistol .50"},
{type = "car", item_name = "t20", count = 1, label = "T20"},
{type = "money", item_name = "bank", count = 20000, label = "20k Money"},
},
}
},
-- ADD HERE unlimited Cases
}
Config.Locales = {
['en'] = {
-- Discord Logs
["discord_title"] = "Case Logs",
["discord_sellmessage"] = "Player %s has pulled the item: %s (%s) Quantity: %s from the Case: **%s**.",
},
['de'] = {
-- Discord Logs
["discord_title"] = "Case Logs",
["discord_sellmessage"] = "Der Spieler %s hat das Item: **%s** (%s) Anzahl: **%s** aus dem Case: **%s** gezogen.",
},
}
›config_server.luaComplete file · 16 lines
Server_Config = {}
Server_Config.WebhookSettings = {
color = 159900,
name = "SIX-CASE",
icon_url = "https://i.imgur.com/JFU0rBJ.png",
author_url = "https://i.imgur.com/JFU0rBJ.png",
server_name = "6-services"
}
Server_Config.Webhooks = {
['reward_case'] = {
link = "https://discord.com/api/webhooks/...",
enable = true
},
}
Careful
Older downloads have a foreign webhook link in config_server.lua with enable = true. Replace it with your own link or set enable = false, otherwise your case logs do not arrive in your own Discord.
05Troubleshooting
Rewards show without a picture.
Config.PathInventory is wrong or the icon is not a PNG named exactly like item_name.
The case item cannot be used.
The item name must match the key in Config.Casesystem exactly, including upper and lower case.
06Still stuck?
Open a ticket on our Discord. Send the script name, your framework and version, and the full error from the server console (F8 for client errors). That saves a round of questions.
