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:

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:

PlayerData

local Player = Casino.GetCasinoPlayer(playerId)

GameData

local GameData = Player.currentGame

GameTypes

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