Developer API
Frozen Poker developer API: money and item functions, the framework bridge for any framework, notifications, events and the hand evaluator.
On this page
The game logic is protected, but everything that touches your server is open: the framework bridge, the money and item functions, notifications and the UI. This page lists what you can change or call.
Open files
| File | Side | What's in it |
|---|---|---|
server-editme.lua | Server | Money, items, names, admin check, notifications, the pokertable item |
client-editme.lua | Client | How notifications are shown |
bridge/esx/server.lua, bridge/qb/server.lua, bridge/qbox/server.lua, bridge/vrp/server.lua | Server | One file per framework. Each only runs when its framework is started |
config.lua, locale.lua | Shared | Settings and texts |
html/ | UI | The full Vue UI: layout, styles, sounds and UI texts |
Server functions (server-editme.lua)
These are global functions inside the resource. The game calls them whenever money moves, so change them here to plug in your own economy.
A currency is a table like { type = "account", name = "money", label = "Cash" } or { type = "item", name = "casino_chips", label = "Casino chips" }. Every table has one; set it in /pokeradmin.
| Function | Returns | What it does |
|---|---|---|
PokerPay(playerid, currency, amount) | Gives amount of currency to the player. Also used for tournament prizes | |
PokerCharge(playerid, currency, amount) | Takes amount of currency from the player. Also used for tournament buy-ins | |
PokerFunds(playerid, currency) | number | How much of currency the player has |
GiveMoneyToPlayer(playerid, amount, tableID?) | Pays the player in the table's currency | |
RemoveMoneyFromPlayer(playerid, amount, tableID?) | Charges the player in the table's currency | |
GetPlayerMoney(playerid, tableID?) | number | The player's balance in the table's currency |
GetPlayerName(playerid) | string | Name shown at the table (character name from the bridge) |
GetPlayerLicenseIdentifier(playerid) | string | The player's license: identifier without the prefix. Used as the table owner |
IsPlayerAdmin(playerid) | boolean | true if the player is in Config.AdminGroup |
SendNotification(src, text) | Sends a notification to the player |
tableID is optional: without it, the table the player sits at is used. Amounts are rounded down, and nothing happens for amounts of 0 or less.
Example: a casino chips item with your own inventory
function PokerPay(playerid, currency, amount)
amount = math.floor(tonumber(amount) or 0)
if amount <= 0 then return end
if currency.type == "item" then
exports.my_inventory:AddItem(playerid, currency.name, amount)
else
AddMoney(playerid, currency.name, amount)
end
endThe poker table item
When Config.CreationItem = true, using the pokertable item starts table placement. The item is only removed once the table is placed:
RegisterUsableItem("pokertable", function(source)
PokerPendingPlacement[source] = "item"
TriggerClientEvent("frozen_poker:createTable", source)
end)To give out tables another way (a shop, a job reward), give the player the pokertable item.
Framework bridge (bridge/*/server.lua)
The script picks the bridge for the framework that is started (es_extended, qb-core, qbx_core or vrp). For any other framework, copy one bridge file, change the GetResourceState check at the top to your core resource, and fill in these functions:
| Function | Returns | What it must do |
|---|---|---|
GetPlayer(source) | player object | Your framework's player for this server ID |
GetName(source) | string | Character name shown at the table |
HasPermission(source, group) | boolean | Whether the player is in that admin group |
RegisterUsableItem(item, cb) | Register a usable item that calls cb(source) | |
AddMoney(source, account, amount) | Add money to an account (money, bank, black_money) | |
RemoveMoney(source, account, amount) | Remove money from an account | |
GetPlayerAccountFunds(source, account) | number | Balance of an account |
AddItem(src, item, amount) | Give an item | |
RemoveItem(src, item, amount) | Take an item | |
GetItemCount(src, item) | number | How many of an item the player has |
Example skeleton:
if GetResourceState('my_core') ~= 'started' then return end
Framework = 'my_core'
GetPlayer = function(source) return exports.my_core:GetPlayer(source) end
GetName = function(source) return GetPlayerName(source) end
HasPermission = function(source, group) return IsPlayerAceAllowed(source, 'group.' .. group) end
RegisterUsableItem = function(item, cb) exports.my_core:RegisterUsableItem(item, cb) end
AddMoney = function(source, account, amount) exports.my_core:AddMoney(source, account, amount) end
RemoveMoney = function(source, account, amount) exports.my_core:RemoveMoney(source, account, amount) end
GetPlayerAccountFunds = function(source, account) return exports.my_core:GetMoney(source, account) or 0 end
AddItem = function(src, item, amount) exports.my_core:AddItem(src, item, amount) end
RemoveItem = function(src, item, amount) exports.my_core:RemoveItem(src, item, amount) end
GetItemCount = function(src, item) return exports.my_core:GetItemCount(src, item) or 0 endmy_core and its exports are placeholders: use your framework's real functions. The Qbox bridge uses ox_inventory for items.
Notifications
On the server, SendNotification(src, text) triggers the client event frozen_poker:showNotification. On the client, ShowNotification in client-editme.lua shows it with the system set in Config.Notify (gta, ox_lib, esx or qb). For anything else, set Config.Notify = "custom" and add your own call in the custom branch, or replace the handler:
RegisterNetEvent("frozen_poker:showNotification")
AddEventHandler("frozen_poker:showNotification", function(text)
exports.my_notify:Show(text) -- your notification resource
end)Events
| Event | Side | Use |
|---|---|---|
frozen_poker:showNotification (text) | Client | Notification for the player. Trigger it from the server with TriggerClientEvent |
frozen_poker:createTable | Client | Starts table placement. The server only saves the table for admins or after the pokertable item was used |
frozen_poker:kicked (reason, returnPos) | Client | Sent when a player leaves a tournament: stands them up and takes them back to where they were |
frozen_poker:evaluate (cards, cb) | Server | Hand evaluator, see below |
Hand evaluator
The script ships a fast hand evaluator that any server script can call. Cards are strings "<suit>_<rank>", with suit 1 to 4 and rank 2 to 14 (11 = jack, 12 = queen, 13 = king, 14 = ace). Send 5, 6 or 7 cards:
TriggerEvent('frozen_poker:evaluate', { "1_14", "2_14", "3_10", "4_10", "1_2", "2_7", "3_9" }, function(result)
print(result.handName) -- "Two Pairs"
print(result.handType) -- 3
print(result.value) -- higher value = better hand
end)| Field | What it is |
|---|---|
handName | High Card, One Pair, Two Pairs, Three Of A Kind, Straight, Flush, Full house, Four Of A Kind, Straight Flush |
handType | 1 (high card) to 9 (straight flush) |
handRank | Rank inside that hand type |
value | Compare two hands with this: the higher value wins |
bestCards | With 7 cards: the 5 cards that make the hand |
Database
Frozen Poker works with oxmysql or mysql-async. core/db.lua uses whichever one is running (or the one in Config.Database), so there is no database line to edit in fxmanifest.lua.
All tables are created and updated automatically on first start (frozen_poker.sql is included if you want to create them yourself):
| Table | What it holds |
|---|---|
pokertables | One row per table: id, owner (licence identifier), name, position (JSON with x, y, z, h), smallBlind, maxPlayers, style, currency and spectator settings |
poker_stats | Player stats per licence and currency: hands, hands won, showdowns, profit, biggest pot, best hand and tournament results |
poker_tournament_history | One row per finished tournament: name, buy-in, prize pool, players, winner, date and the full results |
poker_tournament_entries | One row per player per tournament: place and prize (for "my tournaments") |
Discord logs
Set Config.DiscordWebhook to a webhook URL. After every hand the script posts an embed with the table name, each player and their bet, the total pot and the winners with their hand.
Still stuck?Ask on our Discord