Skip to content

Installation ​

Requirements ​

  • A recent FiveM server artifact (Lua 5.4) with OneSync: the server checks player positions against the ball
  • oxmysql. Without it np_golf runs on an in-memory store and saves nothing (the console warns)
  • np_prophandler: balls, tee pegs, the club in your hands
  • np_npchandler: the NPC caddie

np_prophandler and np_npchandler are hard dependencies in fxmanifest.lua; start them before np_golf.

  • 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 a caddie job). Without one, np_golf runs standalone with an in-memory wallet (Config.StandaloneMoney) and np_character names when it runs
Inventory np_inventory, ox_inventory, qb-inventory, the ESX inventory The golf bag, clubs, balls, hole-in-one insurance. Without one, the club rents you a 14-club set and range balls
Staff np_admin, np_discord Permission nodes, Resource settings, staff tools, the audit log, the server theme; a Discord log channel
Payments np_payments Green fees through the checkout sheet, stake holds through Charge and Refund. Without it, the framework bank account
Phone np_phone The Fairway app, push notifications, the Dynamic Island
Other np_* siblings np_hud, np_menu, np_drugs, np_character Toasts and prompts, player context options, blood alcohol sway, standalone names. See Bridges & integrations

Steps ​

  1. Put the folder into your resources as np_golf. The NUI calls https://np_golf/…, np_phone loads web/dist/phone.html from it and other resources call exports.np_golf, so keep the name.
  2. Build the UI once:
    sh
    cd web && npm ci && npm run build
    This creates web/dist/index.html (HUD, clubhouse, scorecard, bets, bag, caddie view) and web/dist/phone.html (the Fairway app). web/dist is not committed, so a fresh clone starts with a blank UI until you build it.
  3. Database: the tables (all prefixed np_golf_) are created on start (Config.AutoCreateTables = true). To create them by hand, import sql/np_golf.sql.
  4. Start order in server.cfg. The framework and the inventory are detected once, at start, so start them first. np_prophandler and np_npchandler must start before np_golf too:
    cfg
    ensure oxmysql
    ensure np_prophandler
    ensure np_npchandler
    ensure es_extended        # or qbx_core / qb-core
    ensure np_inventory       # or ox_inventory / qb-inventory
    ensure np_payments        # optional: the checkout sheet for fees, Charge / Refund for stake holds
    ensure np_hud             # optional
    ensure np_phone           # optional: the Fairway app
    ensure np_admin           # optional
    ensure np_golf
  5. Items: with np_inventory nothing to do, they are registered at runtime. With the ESX inventory import sql/esx_items.sql; with ox_inventory or qb-inventory add the items yourself. See Items & the bag.
  6. Staff: nothing goes into server.cfg. See Permissions.
  7. Check shared/config.lua: at least the cart barn position and, if you want a real job for caddies, Config.Caddie.job.

Permissions ​

np_golf 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).

Node Grants
np_golf.admin Every golf staff tool: roll new wind (/golfwind), end rounds, void bets, reset a handicap. Passes every other node too
np_golf.marshal End a round (/golfend), void a round's spectator bets after a proven exploit
np_golf.survey /golfsurvey <hole>: measure a real green and store its slope

With np_admin its permission matrix decides, under the category Golf. Without np_admin the lib allows the server console, the identifiers in np_admin_fallback and, on es_extended, the ESX groups in np_admin_fallback_groups. See Concepts → Permissions.

Tables ​

Table Holds
np_golf_players One row per character: handicap index, rounds, best nine, longest drive, membership, stats, caddie XP and ratings, bet limit, break and cooldown, preferences (ball, tracer colour)
np_golf_rounds Every round: course, format, holes, status, players, result
np_golf_scores Strokes, putts and penalties per round, character and hole
np_golf_shots Every shot: club, lie, result, carry, total, power, snap
np_golf_differentials Score differentials for the handicap index
np_golf_teetimes Booked tee-sheet slots
np_golf_escrow Stake holds: amount, used, payment reference, status
np_golf_bets Prop and spectator bets with odds, status and payout
np_golf_payouts Winnings owed to players who were offline, paid at their next login
np_golf_course Green slopes measured with /golfsurvey (they override the config)

Check it works ​

  1. Go to the pro shop door at the Los Santos Golf Club (the green golf blip). E at the desk opens the clubhouse.
  2. Pick a free tee time, check in and walk to the 1st tee. The hole flyover plays.
  3. Walk to your ball, E addresses it, then three left clicks swing.
  4. Hold TAB for the scorecard; /golfquit leaves the round.

Troubleshooting ​

Problem Fix
Blank screen, nothing visible Build the NUI (web/dist missing)
oxmysql is not started: using the in-memory repository Start oxmysql before np_golf, or nothing is saved
Everyone plays with a rental set No inventory with the golf items was found. Add the items, or start np_inventory before np_golf
A swing looks off (ped stands beside or behind the ball) The stance offsets in Config.Native.stance are tuned values; adjust them per club family
The hole drawing on the radar sits off-centre GTA expects its golf script to zoom the radar; np_golf doesn't lock the minimap. Config.Native.minimap = false turns it off
Putts break the wrong way Green slopes are configured until measured. Run /golfsurvey <hole> on each green
Fees open no sheet np_payments isn't running or Config.UseNpPayments = false: fees come from the framework bank directly