Skip to content

Items & the bag ​

np_golf uses six items. Clubs are one item, golf_club, whose metadata says which club it is; the golf_bag is a container that holds clubs and balls. Item names are in Config.Items.

Item Label Weight Stack What
golf_bag Golf Bag 2.5 kg no Container: 20 slots, 12 kg, only golf items. Carries up to 14 clubs and your balls
golf_club Golf Club 400 g no One club. Metadata { club = '7i', set = 'blade', wear = 100 }
golf_ball_tour Golf Ball · Tour X 45 g yes More spin: checks on the greens
golf_ball_distance Golf Ball · Distance Soft 45 g yes A few yards longer, rolls out
golf_ball_glow Golf Ball · Glow 45 g yes For twilight rounds
golf_hio_insurance Hole-in-One Insurance 5 g yes Pays Config.Economy.hioPayout ($5,000) when you ace a hole; one item is used up

club is a key of Config.Clubs.list (dr, 3w, 5w, 4h, 5i … 9i, pw, gw, sw, lw, pt), set a head style (stock, cavity, blade, tour; see Configuration → Clubs) and wear goes down by Config.Economy.wearPerRound (2) after every round.

np_inventory ​

Nothing to do. np_golf registers the six items at start and again whenever np_inventory restarts, with RegisterItem; golf_bag is registered as a container with a whitelist of the golf items. The server reads the bag's contents directly, so clubs and balls work from the pockets or from inside the bag. While a player addresses the ball, np_golf sets np_inventory's busy lock and closes an open inventory. See np_inventory → Items.

lua
-- give a player a forged-blade 7-iron
exports.np_inventory:AddItem(src, 'golf_club', 1, { club = '7i', set = 'blade', wear = 100 })

ESX inventory ​

Import sql/esx_items.sql. The ESX inventory has no metadata, so a golf_bag item counts as a full bag of the Config.Items.esxSet head style ('cavity'), and ball items are counted from the pockets. There is no club wear.

ox_inventory and qb-inventory ​

Add golf_bag, golf_club, golf_ball_tour, golf_ball_distance, golf_ball_glow and golf_hio_insurance to the item list with the labels and weights above. Both keep metadata, so clubs are single items with { club, set, wear }. On ox_inventory the golf_bag works as a container when you define it as one; qb-inventory has no bag containers, so clubs and balls are read from the pockets.

How the bag is read ​

At check-in the server reads the player's pockets and every golf_bag they carry:

  • Up to 14 clubs (Config.Clubs.maxInBag), one per club key; extra copies are ignored.
  • No putter in the bag? A rental putter is added, marked borrowed.
  • No clubs at all: the club rents a 14-club set of Config.Clubs.rentalSet (stock). Its price is Config.Economy.rentalClubs (0: included in the green fee).
  • Balls: the preferred ball (set in the bag screen) if you carry it, else the first one you own, else a range ball. A ball that ends in water or out of bounds removes one ball item (Config.Balls.loseBalls).

Bag & caddie

/golfbag opens the bag screen: a gapping chart (carry and roll per club, gaps over 20 yd marked), the head-style trade-offs, the ball in play, the tracer colour (white, green, blue, red, orange, aqua, pink) and your caddie level and perks.