Exports
Connect STG Billiards to your own target, context menu or interaction system with the client exports for playing a table and taking a shot.
Billiards supports ox_target, qb-target and the [E] prompt out of the box. If your server uses its own target or context menu, call these exports from your menu instead. All exports are client side and take the table entity your menu is pointing at.
Client exports
isTable
local isPoolTable = exports['stg-billiards']:isTable(entity)Returns true when the entity is a pool table the script can use. Use it to decide whether to show the pool options in your menu.
playTable
exports['stg-billiards']:playTable(entity)Same as Play Pool. On a free table it opens the game select menu, on a table with a player waiting it joins that game.
canTakeShot
local canShoot = exports['stg-billiards']:canTakeShot(entity)Returns true when the player is in a 2 player game on this table, it is their turn and they walked away from the table. Use it to show the Take Your Shot option only when it can be used.
takeShot
exports['stg-billiards']:takeShot()Same as Take Your Shot. Brings the player back to the table for their shot.
Example
-- in your own target or menu resource
if exports['stg-billiards']:isTable(entity) then
if exports['stg-billiards']:canTakeShot(entity) then
AddMenuOption('Take Your Shot', function()
exports['stg-billiards']:takeShot()
end)
end
AddMenuOption('Play Pool', function()
exports['stg-billiards']:playTable(entity)
end)
endAddMenuOption stands for your own menu's function. Set Config.TargetSystem = false in shared/config.lua so the script does not register its own target options next to yours.
Still having trouble?
Open a ticket on our Discord. Our team answers around 15 hours a day.