Documentation
R_Casino

r_casino Exports

Server exports to add, remove and read r_casino coins from your other resources, plus console commands and sharing coins with r_store.

Available Exports

All exports are server-side.

Add Coins

Give casino coins to a player

Remove Coins

Take coins from a player

Get Balance

Check a player's coin balance

Add Coins

exports['r_casino']:addCoinsToPlayer(amount, playerId)

You can also target an offline player by identifier (license / citizenid) instead of a server id:

exports['r_casino']:addCoinsToPlayer(amount, nil, identifier)

Example

-- Reward player id 1 with 1000 coins
exports['r_casino']:addCoinsToPlayer(1000, 1)
The player doesn't need to have opened the casino before. Their balance row is created on the first grant, so Tebex packages and join rewards always land.

Remove Coins

exports['r_casino']:removeCoinsFromPlayer(amount, playerId)

Example

exports['r_casino']:removeCoinsFromPlayer(100, 1)
The removal is atomic. If the player doesn't have enough coins, nothing is removed.

Get Balance

exports['r_casino']:getPlayerCoinBalance(playerId)

Example

local balance = exports['r_casino']:getPlayerCoinBalance(1)
print("Player has " .. balance .. " casino coins")

Console Commands

giveCasinoCredits [playerId] [amount]
r_casino:giveCredits [amount] [identifier]

Both are console/admin only. The second form targets a player by identifier, so it works for offline players. Handy for Tebex packages.

Using R_Store Coins

If you share a balance with r_store:

-- In r_casino config.lua
R.UseRStoreCoins = true
R.RStoreResourceName = "r_store"

The casino then reads and writes coins through r_store. Use r_store's exports to grant balance.