Commands and Exports — Diamond Casino | Quasar Store | Quasar Store
Documentation
Commands and Exports
Every Diamond Casino command, the setup tools for tables and VIP rooms, and the client and server exports for reading and moving chips, locking the casino and hooking into blackjack.
These help when you set up a new map or adjust a table. They print ready-to-paste config lines to the F8 console. Turn on Billiards debug (/casinoconfig → Billiards) or Debug output (General) first, or nothing is printed.
Command
What it does
/poolplace
A see-through pool table follows your aim; the mouse wheel turns it. Press E to print a BilliardConfig.Tables line, or BACKSPACE to cancel.
/vippoolplace
The same for the VIP room's pool table. It prints the offset and heading for its entry in Config.Vip.tables.
/vipoffset
Needs the Events permission. Prints the offset of the spot you aim at from the VIP shell, for moving the room's tables and NPCs.
/pooledit
Shows the playing surface and pockets of the nearest table, with its values on screen.
How another resource works with the casino: a mission that rewards chips, a heist that locks the doors, an economy that replaces blackjack's chip handling.
Reading and moving chips
These work the same way whether chips are an item or a balance on the membership.
lua
-- How many chips the player has (0 without a membership, when memberships are on)local chips = exports['qs-diamondcasino']:GetMemberChips(source)
-- Give chips. Returns false if they could not be given, e.g. no membershiplocal ok = exports['qs-diamondcasino']:GiveChipsToMember(source, 500)
-- Take chips. The reason decides how the casino counts it
exports['qs-diamondcasino']:RemoveChipsFromMember(source, 500, 'admin')
reason
Counted as
'shop' · 'sell' · 'admin'
A purchase, an exchange or an admin removal. Not a bet.
none
A bet. It enters the player into a running Global Jackpot.
Every removal also pays the Casino cut to your society. Always pass a reason unless the chips really are a bet.
Locking the casino
lua
exports['qs-diamondcasino']:ToggleLockCasino(true) -- lock: everyone inside is moved to the entrance
exports['qs-diamondcasino']:ToggleLockCasino(false) -- unlock
This does the same as the Doors tab. The lock lasts until it is undone or the resource restarts.
Replacing blackjack's chip handling
By default blackjack takes and pays chips through the two chip exports above. A custom economy can take over both:
lua
exports['qs-diamondcasino']:SetTakeChipsCallback(function(source, amount)-- take the stake with your own systemend)
exports['qs-diamondcasino']:SetGiveChipsCallback(function(source, amount)-- pay the winnings with your own systemend)
Run your own code when a player sits down at blackjack or stands up, or decide whether they may sit or must leave. A HUD can hide itself here, or a job can be kept away from the tables.
lua
exports['qs-diamondcasino']:SetSatDownCallback(function()-- the player sat downend)
exports['qs-diamondcasino']:SetStandUpCallback(function()-- the player stood upend)
exports['qs-diamondcasino']:SetCanSitDownCallback(function()returntrue-- false refuses the seatend)
exports['qs-diamondcasino']:SetLeaveCheckCallback(function()returnfalse-- true makes the player leave the tableend)
Scaleforms
lua
local Scaleforms = exports['qs-diamondcasino']:Scaleforms()
The helper the casino uses for its on-screen scaleforms, for advanced interface work.
Two events are safe and useful to use from your own resources:
Event
Side
Use
casino:announcement
Client
Shows the casino's gold announcement banner. Trigger it from the server with a message.
casino:settingsApplied
Both, local
Fired after the settings are loaded or changed in /casinoconfig, once the new values are in Config.
lua
-- server: announce something to one player, or to everyone with -1
TriggerClientEvent('casino:announcement', source, 'Your table is ready in the VIP room.')
local ok = exports['qs-diamondcasino']:GiveChipsToMember(source, 2500)
ifnot ok then-- with memberships on, the player has none yet: pay them another wayend
Close the casino during a heist
lua
exports['qs-diamondcasino']:ToggleLockCasino(true)
TriggerClientEvent('casino:announcement', -1, 'The Diamond Casino is closed until further notice.')
-- later
exports['qs-diamondcasino']:ToggleLockCasino(false)
Sell something for chips in your own shop
lua
local price = 1000if exports['qs-diamondcasino']:GetMemberChips(source) >= price then
exports['qs-diamondcasino']:RemoveChipsFromMember(source, price, 'shop') -- 'shop': not a bet-- give the itemend