Cuxial Casino exposes the value of its chips, who is seated where, when a player enters or leaves an area, and a few state bags. Everything else is internal.
Server exports
GetChipValues
Returns the value in dollars of each chip item, without the promotional chip. Useful to count chips as wealth or to price them in another resource.
---@return table<string, integer>
local values = exports.cuxial_casino:GetChipValues()
-- { casino_chip_10 = 10, casino_chip_50 = 50, ..., casino_chip_10k = 10000 }GetPlayerSeat
Returns the seat a player is sitting on, or nil.
---@param src integer
---@return string? seatId
local seatId = exports.cuxial_casino:GetPlayerSeat(source)GetSeatOccupant
Returns the server id of the player on a seat, or nil.
---@param seatId string
---@return integer? src
local src = exports.cuxial_casino:GetSeatOccupant(seatId)A seat id has the form model|x|y|z|index, with the coordinates of the machine or table in decimetres.
Client exports
GetSeat
Returns the seat of the local player, or nil.
---@return { kind: string, game: string, model: string, seatId: string, seatIndex: integer, entity: integer }?
local seat = exports.cuxial_casino:GetSeat()
if seat and seat.game == 'blackjack' then
-- the player is at a blackjack table
endgame names the game of the seat, such as slots, blackjack, roulette, threecard, poker, horses or lounge for sofas and armchairs. entity is the handle at that moment; do not store it.
Client events
Local events, fired on the player's own client.
cuxial_casino:client:zoneEnter / zoneExit
Fired when the player enters or leaves one of the casino areas.
AddEventHandler('cuxial_casino:client:zoneEnter', function(id, access)
-- id: 'casino', 'private', 'gold', 'staff2', 'boss', 'penthouse_lobby', 'penthouse', ...
-- access: 'public', 'vip', 'diamond', 'staff' or 'boss'
end)
AddEventHandler('cuxial_casino:client:zoneExit', function(id, access)
end)cuxial_casino:client:seated / stood
Fired when the player sits down or stands up, with the same table that GetSeat returns.
AddEventHandler('cuxial_casino:client:seated', function(seat)
print(('seated at %s'):format(seat.game))
end)
AddEventHandler('cuxial_casino:client:stood', function(seat)
end)State bags
Written only by the server and replicated to every client.
| State bag | Value |
|---|---|
Player(src).state.casinoPost | Post of an employee on duty: 'dealer', 'cashier', 'bartender', 'security', or false. |
Player(src).state.casinoDrunk | { n, left, win, v } while the player is drunk: n drinks, left milliseconds remaining. nil when sober. |
Drinks from other resources
Any ox_inventory item with a drunk status adds to the casino drunkenness, anywhere on the map. Ten points are one drink; negative values sober up.
['whiskey'] = {
label = 'Whiskey',
weight = 500,
client = {
status = { drunk = 20 }, -- two drinks
anim = { dict = 'mp_player_intdrink', clip = 'loop_bottle' },
usetime = 5000,
},
},