Skip to content

Events, commands & keys ​

Server events ​

server

Server-local (AddEventHandler), never sent over the network. match is the public match.

Event Arguments
np_billiards:matchStarted match
np_billiards:matchEnded result (see below)
np_billiards:rackEnded matchId, winnerIdx, banner = { winner, name, reason, tags, runOut, score }
np_billiards:foul matchId, src, code (scratch, no_contact, wrong_ball, no_rail, illegal_break, clock)
np_billiards:goldenBreak src, matchId (the 9 on the break)
np_billiards:breakAndRun src, matchId (the breaker ran the rack)
np_billiards:betSettled { match, market, outcome, cid, amount, payout, won }
np_billiards:cupEnded { id, bar, name, winner (cid), winnerName, prize }

The matchEnded result:

lua
{ id, table, bar, mode,
  winner,              -- 1 | 2 | nil (void)
  reason,              -- the deciding rack's reason, or 'left' | 'walked_away' | 'disconnect' | 'void'
  score = { a, b }, stake, payout, practice, cupId, void, forfeit,
  elo = { { delta, elo, achievements = { ids } }, { ... } },   -- empty for practice and voids; delta 0 when unranked
  players = { { src, cid, name }, { src, cid, name }? } }

Rack reasons: race, eight_potted, eight_on_break, eight_early, eight_wrong_pocket, eight_foul, nine_potted, golden_break, three_fouls.

lua
AddEventHandler('np_billiards:goldenBreak', function(src, matchId)
  TriggerClientEvent('chat:addMessage', -1, { args = { 'Pool', GetPlayerName(src) .. ' sank the 9 on the break!' } })
end)

Client event ​

client

TriggerEvent('np_billiards:client:forceLeave') makes the local player leave their match (a forfeit when it is staked). np_billiards fires it itself on esx:onPlayerDeath and esx:onPlayerLogout; fire it from your death or logout script on other frameworks.

Commands ​

Command Who What
/cuecase Everyone The cue case (also using a cue, shaft, glove or tip kit)
/poolprofile Everyone Your profile & rank
/poolroom Owners, referees, staff The owner tablet of the nearest bar you manage
/pooladmin calibrate | void | cue | drinks Staff, referees Staff tools (Config.Admin.command)

Keys ​

Key mappings (RegisterKeyMapping): players rebind them in Settings → Key Bindings → FiveM.

Mapping Default Action
+np_billiards_interact E Open the lobby of the table in front of you
+np_billiards_cam TAB Spectators (and the waiting player): cycle follow / overhead / player cam
+np_billiards_bets B Spectators: side bet panel
+np_billiards_react1 … 5 1 … 5 Spectators: clap, ooh, toast, heckle, cheer
+np_billiards_accept / _decline Y / N Answer a challenge (np_hud toasts handle their own keys)

While it is your shot the NUI has focus and reads these itself:

Key Action
Mouse (overhead) · right mouse drag (shoulder) Aim · Shift fine · ← / → nudge
Hold left mouse, pull back, push Stroke (P: assisted click, hold, release)
W A S D · 0 Spin · centre the tip
Q / E Lower / raise the cue (elevation)
V · X Call a pocket (then click it) · call a safety
C Overhead / shoulder cam
H Chalk
R Replay the last shot (slow)
T Shot clock extension
Backspace / Esc Leave (asks first; forfeits a staked match)

With np_menu the table props also get Play pool and, for owners, Owner tablet context options.