Skip to content

np_golf v1.0.0 ​

Golf at the Los Santos Golf Club in Richman. Players book a tee time at the pro shop, play GTA's nine holes with a 3-click swing meter and real putting, keep a scorecard and a handicap, hire another player as their caddie and bet on the round. Every stake runs through server escrow, so nobody has to trust anyone.

The in-world HUD floats free over the game: white text, grey key caps and a white meter. The menus (clubhouse, scorecard, bets, bag) and the Fairway phone app use the Nimbus UI look of np_hud and np_phone: glossy squircle tiles, frosted grey glass, Quicksand, a white selection ring, and colour only where it means something (under par, money, warnings, water). It runs on es_extended, qbx_core or qb-core, or standalone, with np_inventory, ox_inventory, qb-inventory, the ESX inventory or no inventory. es_extended with np_inventory is the first target. Hard dependencies are oxmysql, np_prophandler and np_npchandler. Staff rights are np_admin permission nodes. No ox_lib, no ACE anywhere.

Tee shot

Putting Shot result
Putting Result
Scorecard Clubhouse
Scorecard Clubhouse
Bets & odds Bag & caddie
Bets Bag
Liquid Glass German
Liquid Glass German

The screenshots come from the browser mock at 1920 × 1080 (see Development). The UI ships in English and German.

Built on GTA's own golf ​

GTA V ships a complete golf minigame, but Rockstar's golf scripts are compiled single-player / GTA Online scripts that can't be extended on FiveM. np_golf is a faithful rebuild on the game's native golf assets: the same course, the same swing animations, props, flyover cameras, tracer and sounds. On top of that it adds what the original never had: a server-side ball simulation, clubs from your own bag, shot shapes, green reads, handicaps, a shared tee sheet, player caddies and escrow betting.

Every asset name is in shared/config/natives.lua, checked against DurtyFree's gta-v-data-dumps and the FiveM native reference. Swap any name there if a game build differs.

Kind Native assets reused
Course Tee and pin positions of GTA's 9 holes, GTA's pars (5-4-3-4-4-3-4-5-4, par 36), the IPL golfflags (the pin flags)
Animations mini@golf (wood_ / iron_ / wedge_swing_intro · idle · action _high / _low, putt_intro · idle · action, swing_outro, wedge_swing_outro, putt_outro), mini@golfhole_preview (hole_01_cam … hole_09_cam), mini@golfreactions@generic@ (swing_react_good_01/02, swing_react_bad_01/02, putt_react_good_01-03, putt_react_bad_01-03), mini@golfai, mini@golfclub_bag, the movement clipset move_m@golfer@, the scenario WORLD_HUMAN_GOLF_PLAYER
Props prop_golf_ball, prop_golf_tee, prop_golf_driver, prop_golf_wood_01, prop_golf_iron_01, prop_golf_pitcher_01, prop_golf_putter_01, prop_golf_bag_01, prop_golf_marker_01, prop_golfflag
Vehicle and ped caddy (the golf cart), a_m_y_golfer_01 (the NPC caddie)
Cameras DEFAULT_ANIMATED_CAMERA with PLAY_CAM_ANIM for Rockstar's hole flyovers
Particles scr_minigamegolf: scr_golf_ball_trail (the tracer), scr_golf_tee_perfect, scr_golf_strike_fairway, scr_golf_strike_fairway_bad, scr_golf_strike_thick_grass, scr_golf_strike_bunker, scr_golf_landing_thick_grass, scr_golf_landing_bunker, scr_golf_landing_water
Sounds Banks GOLF_I, GOLF_2, GOLF_3; GOLF_BACK_SWING_HARD_MASTER, GOLF_FORWARD_SWING_HARD_MASTER, GOLF_FORWARD_SWING_PERFECT_VB_MASTER, GOLF_BALL_CUP_MASTER, GOLF_BALL_CUP_MISS_MASTER, GOLF_BALL_IN_WATER_MASTER, GOLF_BALL_ROLL_PUTT_MASTER, GOLF_HUD_HOLE_IN_ONE_MASTER, GOLF_HUD_SCORECARD_MASTER, GOLF_BIRDIE / GOLF_EAGLE (HUD_AWARDS)
Materials GrassShort, Grass, GrassLong, SandLoose (plus SandCompact, SandDryDeep, Water, Tarmac, Concrete, Bushes, Soil) through GET_SHAPE_TEST_RESULT_INCLUDING_MATERIAL
Natives SET_MINIMAP_GOLF_COURSE / SET_MINIMAP_GOLF_COURSE_OFF (the golf radar per hole), GOLF_TRAIL_* (optional native preview trail)

Rockstar's own golf scripts (golf, golf_mp, launcher_golf, golf_ai_foursome, golf_ai_foursome_putting) are terminated every 15 seconds (Config.SuppressNativeScripts), so they can't start at the club on servers that run single-player scripts.

At a glance ​

  • The real course. GTA's nine holes with their tees and pins, the three ponds and the course boundary. Distances use GTA's golf scale (about 2 displayed yards per world metre), so real-world club carries fit: about 3,370 yd for nine holes. 18 holes are the nine played twice.
  • GTA's swing flow. Walk to your ball, press E to address it, and the ped takes GTA's stance and plays the mini@golf clips for woods, irons, wedges and the putter. The flyover plays at every new hole, the camera follows the ball, the ball carries Rockstar's tracer. See Playing a round.
  • 3-click meter with a snap zone, an over-swing zone and a "Perfect" snap; shot shape and loft chosen, not rolled; a preview, landing ring and dispersion ring from the same physics the server runs.
  • Putting with a pace meter in feet, a green read (R), daily green speed and match-play gimmes.
  • Formats: stroke play, match play, skins, Stableford and best ball 2v2, gross or net, with a WHS-style handicap index. See Clubhouse & tee sheet.
  • Clubhouse: 10-minute tee times shared by the server, public or private groups, house rules, green fees (member and twilight prices), cart seats, a range bucket and memberships.
  • Betting through escrow: skins, match play, Nassau, closest to the pin, long drive, Sandy, Greenie and prop bets mid-round, plus a spectator odds board with responsible-play limits. See Betting & escrow.
  • Caddie as a player job, with levels, ratings, tips and an NPC fallback. See Caddies.
  • Clubs and balls are items: a golf_bag container with up to 14 clubs, club wear, balls lost in water. See Items & the bag.
  • Fairway app for np_phone: tee times, live leaderboards, odds, handicap trend and bet limits, and your round in the Dynamic Island. See Fairway app.

How it works ​

  • Server ball simulation. The client sends only its inputs (club, shape, loft, aim and the three click times) with a one-shot turn token. The server checks the turn, the distance to the ball, the club and the timing, re-computes power and snap from the click times, simulates flight (wind, lie, elevation, shape, dispersion, blood alcohol sway) and roll, and returns the path every client animates.
  • Lies come from the server's course polygons (water, out of bounds, green, fairway corridor), refined by the client's collision-material probe. A client hint can only make a lie worse.
  • Money. Fees are spent (to the golfclub society by default). Stakes are only held: every dollar in a pool is paid to a winner, kept as the club's cut, or released back. Holds left over from a restart are refunded at start; offline winners are paid at their next login.
  • Wind is server-owned and shared through GlobalState.npGolfWind. It changes every 7 minutes.

Quick example ​

lua
-- server: a tournament script runs a round without check-in or fees
local groupId = exports.np_golf:CreateGroup(hostSrc, { format = 'stableford', holes = 9, public = false })
for _, src in ipairs(entrants) do exports.np_golf:AddToGroup(groupId, src) end
local ok, roundId = exports.np_golf:StartRound(groupId)

AddEventHandler('np_golf:roundFinished', function(id, results)
  if id ~= roundId then return end
  for _, p in ipairs(results.players) do print(p.name, p.gross, p.toPar) end
end)

Next steps ​