Hooks and exports

Run your own code before a player sits or plays, after each round and at the bar, call Casino Creator from your own scripts, and follow its actions in gg_lib.

Casino Creator has three server hooks in gg_casino/core/open/server/main.lua and two client hooks in gg_casino/core/open/client/main.lua. Those files are never encrypted, so you can edit them. Return nil from a hook to keep the script's own behavior. An update replaces them, so keep a copy of your changes.

Server hooks

Before a player plays

Lua
function open.canPlay(source, game)
    return true
end

Runs before a player sits down or puts a bet on a game: the tables, the machines, the prize wheels and the casino app. Return false to stop them. A key from locales/en.json as a second value picks the message they see.

Lua
function open.canPlay(source, game)
    -- only players with the casino.vip ace may sit at Texas Hold'em
    if game == "holdem" then
        return IsPlayerAceAllowed(source, "casino.vip")
    end

    return true
end

After a round

Lua
function open.onSettle(source, entry)
end

Runs each time a round is settled for one player, after they are paid.

FieldMeaning
entry.gameThe game's id
entry.placeThe id of the table, machine or wheel it was played at
entry.roundThe round's id
entry.stakeWhat the player put in, in chips (credits at a machine)
entry.payoutWhat the round paid, in chips (credits at a machine)

At the bar

Lua
function open.feed(source, food, water)
    return nil
end

Runs when a player has something from a casino bar. food and water are 0 to 100. Return true when your server filled hunger and thirst itself, false to do nothing, or nil to let the script do it on Qbox, QBCore or esx_status.

Client hooks

Before a player sits

Lua
function open.canSit(game)
    return true
end

Runs on the player's own game before they take a seat at a table, machine or wheel. Return false to keep them standing.

Lua
function open.canSit(game)
    -- no sitting down in cuffs
    return not IsPedCuffed(PlayerPedId())
end

Dead or down

Lua
function open.isDown()
    return nil
end

Whether the player is dead or in last stand. Return nil to keep the script's own check, which reads the game and the common frameworks. Return true or false to answer for your own death script. A player who is down cannot sit. A player found down at a game loses the round in play and is moved off the seat.

Exports

All exports are server side: exports.gg_casino:Name(...).

ExportWhat it does
IsCasinoOpen(id)Whether a casino can be played now: Enabled and inside its hours
SetCasinoOpen(id, on)Turns a casino's Enabled on or off
IsCasinoPresent(id)Whether a casino is in the world now
GetCasinoBuilding(id)The resource name of the map a casino stands in, or nil
swapMachine(id, game, look, opts)Swaps the machine at place id for another game. opts.force puts it down even into a neighbor. Nobody may be playing it. Gives true and the place, or false and why
mayOwnGames(source)Whether a player may own machines, tables and wheels under Only Listed Players Can Own Games
BanFromCasino(player, casino, minutes, reason)Bars a player from one casino. minutes 0 is for good. Gives true, or false and why
UnbanFromCasino(player, casino)Lets a player back in. Gives true when they were barred
IsBannedFromCasino(player, casino)Whether they are barred, and until when (os.time(), 0 for good)
LockOutOfGambling(player, days, reason)Locks a player out of gambling everywhere. days is 1, 7, 30, 180, or 0 for good. Gives true, or false and why
LiftGamblingLockout(player)Lets a player gamble again. Gives true when they were locked out
IsLockedOutOfGambling(player)Whether a player is locked out now
  • player is a server id for someone on now, or a character's identifier.
  • casino is a casino's id or its name under Casinos.
  • id in the first four is a casino's id. The ready-made casinos are belladonna, baylight, pricklypair, fourdragons, gabzdiamond, pearls, molocasino, jurassicjackpot and patoche.
Lua
-- close the Belladonna for an event
exports.gg_casino:SetCasinoOpen('belladonna', false)

-- bar a player from the Baylight for a day
local ok, why = exports.gg_casino:BanFromCasino(source, 'baylight', 1440, 'Card counting')

Game ids

game and entry.game are these ids. The casino app's games use their own, which start with phone_.

KindGames
TablesBlackjack blackjack, Roulette roulette, Baccarat baccarat, Texas Hold'em holdem
MachinesEmber Crown Link ember_crown, Prism Falls prism_falls, Vault Row vault_row, Drop Zone drop_zone, Furnace 7s furnace7, Fuego 7s fuego7s, Ice Carat ice_carat, Titan Isle titan_isle, Solar Scarab solar_scarab, Neon Overdrive neon_overdrive, Leviathan Deep leviathan_deep, Aurora Howl aurora_howl, Event Horizon event_horizon, Starfall starfall, Chiliad Storm chiliad_storm, Pier Pressure pier_pressure, Jade Lantern Wheel jade_lantern, Video Poker video_poker, Vinewood Sevens vinewood_sevens, Stacked Poker multi_poker, Comet Keno video_keno, Dead Draw dead_draw, Hop City hop_city, Penthouse Express penthouse_express, Vespucci Fireworks vespucci_fireworks, La Mesa Murals la_mesa_murals, Four Corners four_corners, Blaine County Legends blaine_legends, Mirror Park mirror_park, Twelve Moons twelve_moons, Hot Plate 68 hot_plate, Dock Stack dock_stack, Rockford Flip rockford_flip, Chumash Swell chumash_swell, Sandy Saucers sandy_saucers
WheelsPrize Wheel prize_wheel

Actions in gg_lib

Casino Creator reports these actions to gg_lib. They show in /ggsettings under Logs > Activity. Under Activity Types you can send them to a Discord webhook with an Alert (casino.* for all of them), or press Code for a hook to paste into gg_lib/hooks/server.lua. See gg_lib hooks.

ActionNameWhen
casino.buyinMoney InA player put money in: chips or a slip at the cage, or money into a machine or the app
casino.cashoutMoney OutA player took money out: chips or a slip cashed, Held Winnings collected, a machine or the app cashed out
casino.bigwinBig WinOne round paid at least the Big Win Amount
casino.jackpotJackpotA machine hit one of its jackpots
casino.wheelWheel MadeA prize wheel was made or changed
casino.prizeWheel PrizeA prize wheel gave a car, or a prize worth at least the Big Win Amount
casino.receiptGift Receipt RedeemedA gift receipt was redeemed
casino.iouIOUA casino owed a player money it could not pay at once, or paid it
casino.dirtyDirty MoneyDirty money handed in, given back or paid out washed
casino.ownerCasino MoneyMoney in or out of a casino's float or account
casino.floorCasino Floor ChangedSomething placed, changed or removed in the builder, or set down, picked up, seized or removed in a player casino
casino.staffBarred Or Locked OutA player barred or let back in, or locked out of gambling or let back
casino.adminAdmin MoneyAn admin gave or took chips, or paid or cleared a player's Held Winnings
casino.flagFlaggedSomething that looks like an exploit, such as a burst of payouts

Every action carries source, name and identifier. Money is in dollars. In a hook, put gg_casino: in front of the action:

Lua
GGHook('gg_casino:casino.bigwin', function(data)
    print(("%s won %s on %s"):format(data.name, data.payout, data.game))
end)

Money In and Money Out are the busiest. To send them to a channel of their own, give each its own Alert.

Support

Questions before you buy?

Ask the team in our Discord before you pay a thing. Setup help, update notes, giveaways and discount codes, all in one place.

711 online now2,300 members