Installation ​
Requirements ​
- A recent FiveM server artifact (Lua 5.4)
- oxmysql. Without it ratings, matches and escrow can't be stored (the console warns)
- np_prophandler 1.1.0+: spawned and runtime tables, the balls and the cue, the hidden vanilla balls. A hard dependency in
fxmanifest.lua; start it before np_billiards - Node 18+ to build the NUI once
Optional, auto-detected at start:
| Kind | Resources | Used for |
|---|---|---|
| Framework | es_extended, qbx_core, qb-core | Character id, name, cash and bank, jobs for bar owners and referees. Without one, np_billiards runs standalone with an in-memory wallet (Config.StandaloneMoney) and np_character characters when it runs |
| Inventory | np_inventory, ox_inventory, qb-inventory, the ESX inventory | Owned cues, shafts, chalk, gloves and re-tip kits. Without one, everybody plays with the house cue and house chalk |
| Society | esx_addonaccount, qb-banking / qb-management, Renewed-Banking | Bar income (fees, house cut, rake) and the cloth recovery cost. Without one, income is only tracked in np_billiards_revenue |
| Payments | np_payments | Fees, stakes, bet and cup entries through Charge, refunds through Refund. Without it, the framework account Config.PayAccount |
| Phone | np_phone | The Pool League app, push notifications, the Dynamic Island |
| Staff | np_admin, np_discord | Permission nodes, Resource settings, staff actions, the audit log, staff alerts, the server theme; a Discord log channel |
| Other np_* siblings | np_hud, np_menu, np_drugs, np_character | Toasts and the table prompt, context options on the table props, blood alcohol for the aim sway, standalone names. See Bridges & integrations |
Steps ​
- Put the folder into your resources as
np_billiards. The NUI callshttps://np_billiards/…, np_phone loadsweb/dist/phone.htmlfrom it, items callnp_billiards.useItemand other resources callexports.np_billiards, so keep the name. - Build the UI once:shThis creates
cd web && npm ci && npm run buildweb/dist/index.html(markers, lobby, aiming HUD, spectator HUD, cue case, profile, owner tablet) andweb/dist/phone.html(the Pool League app).web/distis not committed, so a fresh clone starts with a blank UI until you build it. - Database: the tables (all prefixed
np_billiards_) are created on start (Config.AutoCreateTables = true). If your database user may notCREATE TABLE, importsql/np_billiards.sqlyourself. - Start order in
server.cfg. The framework, the inventory and the society resource are detected once, at start, so start them first. np_prophandler must start before np_billiards too:cfgensure oxmysql ensure np_prophandler ensure es_extended # or qbx_core / qb-core ensure np_inventory # or ox_inventory / qb-inventory ensure esx_addonaccount # optional: bar society accounts ensure np_payments # optional ensure np_hud # optional ensure np_phone # optional: the Pool League app ensure np_admin # optional ensure np_billiards - Items: with np_inventory nothing to do, they are registered at runtime. With the ESX inventory import
sql/items_esx.sql; with ox_inventory or qb-inventory add the items yourself. See Items & the cue case. - Bars that are businesses get an owner and a referee job in
config/tables.lua(owner = { job = 'yellowjack', grade = 3 }, referee = { job = 'yellowjack', grade = 1 }). Fees, the house cut and the rake then go to that society. See Bars, tables & the owner tablet. - Staff: nothing goes into
server.cfg. See Permissions.
Permissions ​
np_billiards never uses ACE. Every staff check is npAdmin.can(src, node) of the np_admin lib that ships in
bridge/np_admin.lua (np_admin stays optional: no dependency, no @np_admin include). The nodes show up under the
category Billiards:
| Node | Grants |
|---|---|
np_billiards.admin |
Every billiards staff tool: the calibration overlay, giving cues, setting drinks, closing tables, voiding matches; also counts as owner of every bar |
np_billiards.owner |
Open the owner tablet of any bar (house rules, cloth, cups, revenue) |
np_billiards.referee |
Pause or void a match at any table, /pooladmin calibrate and /pooladmin void |
Bar owners and referees don't need a node: the job and grade in Config.Bars[*].owner / .referee are enough for
their own bar. On a standalone server (no framework) those jobs come from np_admin nodes too:
np_billiards.job.<job> (with np_billiards.job.<job>.<grade> for grades 1–10) and np_billiards.boss.<job>.
With np_admin its permission matrix decides. Without np_admin the lib allows the
server console, the identifiers in the convar np_admin_fallback and, on es_extended, the ESX groups in
np_admin_fallback_groups (default admin,superadmin). See Concepts → Permissions.
Tables ​
| Table | Holds |
|---|---|
np_billiards_players |
One row per character: name, overall ELO, and a JSON blob with peak, games, wins, per-mode ELO, style stats, form, ELO history, achievements, opponents (head-to-head), loadout, home bar, nickname, season, payouts owed |
np_billiards_matches |
Every finished two-player match: table, bar, mode, players, winner, score, stake, ranked, ELO deltas, cup, reason, the compact shot log and its hash |
np_billiards_tables |
Per table: cloth, closed until, racks played; per bar (bar:<id>): the owner's house rule overrides |
np_billiards_revenue |
Bar income per day and table: fee, cut, rake, cup, upkeep |
np_billiards_escrow |
Money held for a stake, bet, cup entry or remote challenge: amount, np_payments reference, status (held, paid, lost, refunded) |
np_billiards_bets |
Side bets: match, market, outcome, amount, payout, status |
np_billiards_cups |
Cups with status (signup, running, done, cancelled) and their bracket |
Check it works ​
- Go to the Yellow Jack Inn or Tequi-la-la (the bar blips). A marker floats over the table and
E Rack 'em upshows next to it. Eopens the lobby. Pick a mode and Practice: the camera goes overhead and it is your shot.- Move the mouse to aim, hold the left mouse button, pull back and push through. The balls roll on the real table.
- With a second player: challenge them with a stake, they press
Y, and the match starts with both stakes in escrow.
Troubleshooting ​
| Problem | Fix |
|---|---|
| Blank screen, nothing visible | Build the NUI (web/dist missing) |
oxmysql is not started, ratings and matches can not be stored |
Start oxmysql before np_billiards |
| No marker or prompt at a vanilla table | The table binds to a prop within 3 m of its coords. Check the coordinates in config/tables.lua, or that the interior is loaded |
| Balls float above or sink into the felt, pockets look off | Run /pooladmin calibrate next to the table and adjust the model's center, ballZ or length / width in Config.Models |
| Everyone plays with the house cue | No inventory with the pool items was found. Add the items, or start np_inventory before np_billiards |
| Fees and the house cut never reach the bar | The bar has no owner.job / society, or no society resource runs. The money is still in the revenue log |
/poolroom says no permission |
You aren't owner or referee of any bar: set owner / referee on the bar, or grant np_billiards.owner |
| The phone has no Pool League app | np_phone wasn't running at start or Config.UseNpPhone = false. It registers again when np_phone restarts |