CasinoControl (Exports)

Controlling casino from an another resource.

Getting The CasinoControl Object

local Casino = exports["rcore_casino"]:GetCasinoControl()

Functions

Casino.GetCasinoPlayer(playerId)

Returns PlayerData of player. Returns nil if player isn't inside the casino.

Casino.GetCasinoPlayers()

Returns PlayerData array of all players inside casino.

Casino.IsPlayerInCasino(playerId)

Checks if player is currently inside the casino.

Casino.IsPlayerBusy(playerId)

Check if player is busy. Returns true when playing a game, interacting with a bartender, or sitting somewhere. Don't move/teleport/interact with the player if they're busy.

Casino.StopPlaying(playerId)

Force player to finish playing and leave their chair, if busy.

Casino.BlockPlaying(playerId)

Block player from entering games, interacting with bartenders, sitting on chairs. Also forcing them to finish playing if busy. Rejoining the server resets it.

Casino.AllowPlaying(playerId)

Allow player to enter games and interact again.

Casino.KickPlayer(playerId)

Warn player to behave, by kicking them out of the building.

Casino.ToggleVIP(playerId, vip)

Enables or disables VIP Casino Membership of player.

Casino.SetLuckySpinCooldown(playerId, durationseconds)

Set/Reset Lucky Wheel cooldown for player.

Casino.SetFreeDrinksFor(playerId, durationseconds)

Gives player free drinks for duration (Lucky Wheel free drinks price)

Casino.ResendPlayerCasinoProgress(playerId)

Sends player their new progress (VIP state, cooldowns...)

Casino.ToggleCasinoActivity(activity, enabled)

Toggles the casino feature on/off. List of activity names:

activity

slots

luckywheel

insidetrack

drinkingbar

roulette

poker

blackjack

cashier

seating

cameras

officeelevator

officeelevatorout

casinoteleporter

Casino.ToggleCasino(enabled)

Enables/Disables the casino and locks/unlocks the entrance.

Casino.UpdateSetting(setting, settingContent)

Updates the casino setting.

Casino.GetSetting(setting)

Gets the casino setting. List of setting names:

settingdescription

PodiumPriceProps

vehicle props of the actual podium vehicle

PlayerData

local Player = Casino.GetCasinoPlayer(playerId)
PropertyDescription

Player.playerId

Player ID

Player.playerName

Player name

Player.playerChips

Player chips

Player.enterTime

Casino enter time (server game timer)

Player.sessionScore

How much player earned/lost since he entered the casino

Player.currentGame

Player GameData, returns nil when idle

GameData

local GameData = Player.currentGame
PropertyDescription

GameData.type

GameType of current game

GameData.coords

Position of the game, if avaiable

GameData.hash

Model of the playing slot machine, if playing Slots

GameData.bartenderId

Index of the bartender, if using one

GameData.chair

Index of the chair, if playing table games or Inside Track

GameTypes

Blackjack

Inside Track

Lucky Wheel

Roulette

Slots

Bartender

Bar

Sitting

Server Events

AddEventHandler("PlayerJoinedCasino", function(playerId)
    ...
end)
AddEventHandler("PlayerLeftCasino", function(playerId)
   ... 
end)

Client Events

-- Gets local player state
TriggerEvent("Casino:GetPlayerState", function(o)
        if not o then
            return print("I'm not inside the Casino.")
        end
        print("My Balance: " .. o.chips)
        print("Am I Boss: " .. tostring(o.is_boss))
        print("Am I VIP:" .. tostring(o.is_vip))

        print("My Casino Items:")

        for k, v in pairs(o.items) do
            print(k .. " = " .. o.items[k])
        end

        print("Money: " .. o.money)
    end)

Last updated