Installation Guide

Step-by-step setup for oxide-dice — required resources, the inventory you need, server.cfg load order, the database, the three items and their images, optional integrations and a check that it works.

Step-by-step setup for oxide-dice. Follow the steps in order. Most problems come from skipping one.

Before You Start

oxide-dice works on QBCore, Qbox and ESX. It talks to your framework through o-link (the bridge every Oxide resource uses), so there is nothing framework-specific to set up in the script itself. The framework-side work is making sure you run a supported inventory (below) and adding the three items to it (step 4).

You need these resources installed and working first:

ResourceMinimum VersionWhat it does
ox_libany recentProvides translations
oxmysqlany recentConnects the server to your MySQL database
o-link1.11.0 or newerConnects dice to your framework (players, cash, inventory, notifications, targeting) and places tables
A targeting resourceanyThe "look at it and pick an option" menu used to join a game, play at a table, pack a table up and buy dice. o-link supports ox_target, qb-target, sleepless_interact, tgiann-target and oxide-target.
A supported inventorysee belowHolds the dice, dice_table and dice_folding_table items

Why o-link 1.11.0? A player who leaves the server in the middle of a game can be owed two payouts at once, for example a won fade and a won side bet. On ESX, versions before 1.11.0 can let one of them overwrite the other, so the player gets less than they won. If you want players to move the dice controls card with Oxide HUD, you need o-link 1.12.1 or newer.

If you already run other Oxide resources, you have ox_lib, oxmysql and o-link already.

Which inventory you need

The dice items don't store any extra information, so any inventory o-link supports can hold them. These are the usual ones:

FrameworkInventoryWorks with dice?
Qboxox_inventory (Qbox's default)Yes
QBCoreqb-inventory (QBCore's default)Yes
ESXox_inventoryYes
ESXESX's own built-in inventoryNo. o-link doesn't support it, so dice can't check for or hand out the items. Install ox_inventory.

This guide shows how to add the items to ox_inventory and qb-inventory. If you use a different inventory that o-link supports, add the three items the way that inventory adds items, with the names exactly as shown in step 4.

Installation Steps

Place the resource

Put the oxide-dice folder inside your server's resources folder. If you run several Oxide resources, keep them together in a folder named [oxide].

Set the startup order

Your server.cfg is the text file that tells your server which resources to start, and in what order. Every Oxide resource uses the same four-tier order:

server.cfg
# 1. Framework — everything your framework requires (qb-core, es_extended, qbx_core, etc.)
ensure <framework>

# 2. Scripts — your other resources (phone, inventory, garages, etc.)
ensure <your-other-scripts>

# 3. o-link — the bridge. Starts after your framework/scripts, before any Oxide resource.
ensure o-link

# 4. Oxide resources — keep these together, ideally in a folder named [oxide]
ensure oxide-dice

ox_lib and oxmysql belong with your framework in tier 1. There's no required order inside a tier. What matters is that o-link starts after your framework and scripts, and before oxide-dice. If all your Oxide resources are in an [oxide] folder, you can write ensure [oxide] once instead of one line per resource.

Save the file when you're done.

Database: nothing to import

The resource creates its own database tables when it starts, and checks them again every time it starts after that, so there is no SQL script to run.

The database user in your mysql_connection_string (the line in server.cfg that tells oxmysql how to log in to your database) needs permission to create tables. sql/install.sql is a reference copy of the three dice tables; you do not need to import it. The oxide_settings table is created by the settings system and is not in that file.

These are the tables it creates:

TableWhat it stores
dice_tablesEvery dice table players or admins have placed, who placed it, and its bet limits
dice_escrowWhat each player has staked in a game that's still running, so a restart can give it back
dice_owedWinnings or refunds that couldn't be paid at the time, waiting for the player's next login
oxide_settingsThe live configuration you edit in game with /dice settings (see Configuration)

oxide_settings is shared with other Oxide resources on purpose (each resource keeps its own rows), so it's safe to run oxide-dice alongside any other Oxide resource.

Add the items to your inventory

oxide-dice needs these three items to exist in your inventory with the exact spelling shown. None of the names clash with the items stock QBCore, Qbox or ox_inventory already ship, so you don't need to rename anything.

ItemLabelWeight (g)Must be usableWhat using it does
diceStreet Dice50YesPuts a street game down at the player's feet. The dice are not used up: one pair lasts forever.
dice_tableDice Table15000YesOpens the placement tool for a casino table. The item is used up when the table is placed, and comes back when the table is packed up.
dice_folding_tableFolding Dice Table8000YesOpens the placement tool for a folding table with its four chairs. Used up and given back the same way.

"Must be usable" means a player can use the item from their inventory. The script decides what happens when it's used; your inventory just has to allow it.

The labels, weights and descriptions are suggestions. Change them to taste. The names must match exactly. (You can rename the items in the settings menu later, but then the new names must exist in your inventory instead.)

Where the items go depends on your inventory:

  • ox_inventory (Qbox, and ESX servers that run ox_inventory): paste the ready-made file, see below.
  • qb-inventory (default QBCore): add them to qb-core/shared/items.lua, see below.

If you use ox_inventory

This covers Qbox, and any ESX server running ox_inventory. All three items are ready to paste in items/ox_inventory_items.lua.

  1. Open items/ox_inventory_items.lua from the oxide-dice folder in a text editor (Notepad, Notepad++ or VS Code all work).
  2. Copy the three lines between return { and the final }. They start with ['dice'], ['dice_table'] and ['dice_folding_table'].
  3. Open ox_inventory/data/items.lua in the same editor.
  4. Paste the three lines just above that file's final closing }.
  5. Save the file.

ox_inventory has no separate "usable" switch to set: dice registers the items it uses itself.

If you use qb-inventory

This is QBCore's default inventory. The items go in qb-core/shared/items.lua.

  1. Open qb-core/shared/items.lua in a text editor.
  2. Paste the three lines below just above that file's final closing }.
  3. Save the file.
    dice = { name = 'dice', label = 'Street Dice', weight = 50, type = 'item', image = 'dice.png', unique = false, useable = true, shouldClose = true, description = 'A pair of dice. Use them to start a game of street craps at your feet.' },
    dice_table = { name = 'dice_table', label = 'Dice Table', weight = 15000, type = 'item', image = 'dice_table.png', unique = false, useable = true, shouldClose = true, description = 'A portable craps table. Use it to set the table up.' },
    dice_folding_table = { name = 'dice_folding_table', label = 'Folding Dice Table', weight = 8000, type = 'item', image = 'dice_folding_table.png', unique = false, useable = true, shouldClose = true, description = 'A card table and four chairs. Use it to set them up for a game of dice.' },

Keep the comma at the end of each line. useable = true is what lets players use the items from their inventory, so don't change it.

Copy the item images

The items/ folder in oxide-dice has one picture for each item: dice.png, dice_table.png and dice_folding_table.png. Copy all three into your inventory's image folder:

  • ox_inventory: ox_inventory/web/images/
  • qb-inventory: qb-inventory/html/images/

The file names already match the item names, so no renaming is needed.

Restart the server

Restart your server so the inventory loads the new items and images, and oxide-dice starts for the first time. Then run through Check That It Works.

Configure it (in game)

The defaults work out of the box, so you can open to players right away and adjust later.

When you do want to change something, do it in game, not by editing files. As an admin, type /dice settings in the chat box to open the settings menu. Almost every setting is there: bet limits, how many players fit round a circle, timers, side bets, who may place tables, fixed tables, the dice seller and police alerts. Changes apply live and save automatically. See Configuration for how this works, what every setting does, and the few settings that live only in the config files.

The config files (shared/config.lua and the files in shared/config/) are the resource's factory defaults: the values it starts from on its first start. After the first start, the database holds your settings, and editing those files won't change them. Change settings with /dice settings instead.

Worth a look first, all in the menu:

  • Games → Street → Street games: the bet limits for street games and how many players fit round a circle
  • Games → Tables → Dice tables: who may place a dice table (admins only by default), and fixed tables
  • Games → Bets → Side bets: switch side bets off, or limit the odds
  • World → Store → Dice seller: where the seller stands and what dice and tables cost
  • World → Dispatch → Police alerts (switch the menu to Advanced to see it): police alerts from street games, off by default

Optional Integrations

Everything below is optional. Dice runs fine without any of it.

ResourceWhat it addsWhat happens without it
Oxide HUD (free, needs o-link 1.12.1 or newer)Players can move or switch off the dice controls card in /hud, it hides with the HUD, and the dice cards and prompts use your server's accent colour.The card sits at the bottom of the screen and the dice screens stay red.
A dispatch resource o-link supports (ps-dispatch, cd_dispatch, qs_dispatch, lb-tablet and others)Police alerts from street games go into your dispatch system, at the game's location.Players with an alert job get a short notification and a 30-second map blip on the game.
oxide-logger (free)A record of every stake, roll, payout and admin action, in the console, a file or Discord, as you set it up there.The same lines go to your server console.

Police alerts only happen if you turn them on (see Configuration).

Check That It Works

  1. Start the server and watch the console (the black window or txAdmin's Live Console page). Confirm ox_lib, oxmysql, o-link and oxide-dice all start without red errors. A line containing oxide-dice started means everything loaded.
  2. Give yourself admin permission (see Admin), join the server, and make sure your character has at least $50 in cash (money in hand, not in the bank).
  3. Type /dice give dice in the chat box. You should see "Gave 1x dice to player ..." and a Street Dice item in your inventory.
  4. Stand on flat ground, out of any vehicle, and use the Street Dice item. You should see "You put the dice down. Set your bet with E; others join from the circle.", your character sits down on a crate where you stood, the game's tag appears over the middle in front of you, and a small controls card appears at the bottom of the screen.
  5. Press E, type 50, and press ENTER. Your cash drops by $50 straight away (the game is holding it), and the card says "Your $50 is up. Waiting for someone to fade it."
  6. Now finish the test one of two ways:
    • With a second player: they aim at the middle of the circle, under the tag, and pick Join the dice game. They walk to a free spot and sit down on a crate. They press E, type an amount and press ENTER to fade your bet. Your card then says how much is covered: hold the left mouse button to shake the dice and let go to throw. The dice land, the result pops up over the circle, and the money moves.
    • On your own: wait. After 60 seconds you should see "Nobody faded for too long. The game is over and every bet came back.", and your $50 is back in your cash.
  7. Type /dice demo. A circle appears a few steps in front of you and rolls six times by itself, with no money involved. This shows the dice landing, the pot and the tag above the circle.
  8. Type /dice table place. Aim at the ground near you (a see-through table follows your aim) and click the left mouse button. You should see "Table placed. Players start a game at it with the target." Walk up to the table and aim at it: you should see Play dice and Pack up the table. Then try /dice table place folding a few metres away: a small white table with four chairs goes down the same way, and Play dice sits you on a chair.
  9. Open the map and find the Dice Seller blip. Go there, aim at the seller and pick Buy dice to open the store.

If any step fails, see Troubleshooting.

Good To Know

  • Bets use cash in hand only. A player needs the money on them, not in the bank. Winnings are paid into cash; if the framework won't take any more cash (some servers cap cash on hand), the payout goes to the player's bank instead and they're told so.
  • Nobody plays the house. Every dollar a player wins was staked by another player. The resource takes no cut.
  • The server rolls the dice. How hard or where a player throws changes how the dice bounce, never what they show.
  • A restart never eats a bet. If the server or the resource restarts in the middle of a game, every stake is given back the next time it starts: straight away to players who are online, otherwise at their next login.
  • Street games need room. They can't start in a vehicle, in water, on steep ground, or within 6 metres of another game or a dice table.
  • Only admins place tables by default. To let players place their own, change Who may place in Games → Tables → Dice tables (see Configuration). Placed tables stay through restarts.
  • The models and animations ship with the resource. The die, the casino table, the street crate and the dice animations are in stream/ and load automatically. The folding table, its chairs and the cash in the pot are base-game props.
  • The interface ships ready. There is nothing to build, compile, or install for it.
  • Translations: the on-screen notifications, prompts, cards and menu text live in locales/en.json and can be translated there.

Next Steps