Skip to main content

Server API

Every export below is server-side. Call them on exports.road_minigolf.

Courses

GetCourses

All courses with their full data, props included.
table
id -> course. Large: prefer GetCourseList when you only need names and numbers.

GetCourse

One course with its full data.
string
required
The course ID
table | nil
The course, or nil when the ID does not exist.

GetCourseList

A light list of every course, without props, sorted by ID.
table

Players and sessions

IsPlayerInGame

number
required
Player server ID
boolean
true while the player’s game is running (not in a lobby that has not started yet).

GetPlayerSession

The game or lobby the player is in.
number
required
Player server ID
table | nil
Public session info, or nil when the player is in no game or lobby.

GetActiveSessions

Every running game and open lobby.
table

IsAdmin

Whether a player has minigolf admin rights.
number
required
Player server ID
boolean
Player server IDs only: nil, strings, 0 (console) and negative numbers return false.

Leaderboards and statistics

GetLeaderboard

The all-time leaderboard of a course.
string
required
The course ID
number
default:"10"
Number of rows
table
Rows, best first. Empty when the course does not exist.

GetLeaderboards

All three leaderboards of a course.
string
required
The course ID
number
default:"10"
Number of rows per board
table
{ all = rows, month = rows, week = rows } with the same rows as GetLeaderboard.

GetHoleRecords

The record of every hole.
string
required
The course ID
table
One entry per hole: { strokes, name }. strokes = 0 means no record yet.

GetPlayerStats

Statistics of an online player.
number
required
Player server ID
table | nil
nil when the player is offline or never played.

GetPlayerStatsByIdentifier

The same as GetPlayerStats, for offline players.
string
required
The identifier the events on this page carry: the framework’s player identifier, or the FiveM license without a framework

Events

All server events are local events: listen with AddEventHandler. Clients cannot trigger them. New arguments are always added at the end, so existing handlers keep working after updates.

Games

Identifiers are only in the players argument. The payload is the same table the clients get, so it never carries identifiers.

Records

Money

Anti-cheat

Flags never punish on their own. The OpenHooks.OnSuspicious hook in server/open.lua gets the same call.

Admin actions

src is 0 when the action came from the server console. identifier is the admin’s identifier. name is the course name.