Client

Zone/Track Exports

getPolyFromZone

Converts a zone point array into a sorted polygon.

local poly = exports['rcore_formula']:getPolyFromZone(zone)
Parameter
Type
Description

zone

table

Array of points with x, y, z coordinates

zone structure:

{
    {x = 0.0, y = 0.0, z = 0.0},
    {x = 10.0, y = 0.0, z = 0.0},
    {x = 10.0, y = 10.0, z = 0.0},
    ...
}

Returns: table - Array of vector3 points sorted counter-clockwise (polygon vertices).


isPointInPoly

Checks if a point is inside a polygon.

local isInside = exports['rcore_formula']:isPointInPoly(point, poly)
Parameter
Type
Description

point

table/vector3

Point with x, y coordinates

poly

table

Array of polygon vertices (vector3)

Returns: boolean - true if point is inside polygon, false otherwise.

Example:


createWallPoly

Creates a rectangular wall polygon between two points.

Parameter
Type
Description

pointA

table/vector3

First point

pointB

table/vector3

Second point

width

number

Width of the wall

Returns: table - Array of 4 vector3 points forming a rectangle perpendicular to line AB.


getVehicleCorners

Gets the world coordinates of a vehicle's four corners.

Parameter
Type
Description

vehicle

number

Vehicle entity handle

Returns: table - Array of 4 vector3 corner points in world coordinates.

Example:


isVehicleInVirtualWall

Checks if any corner of a vehicle intersects with a wall polygon.

Parameter
Type
Description

vehicle

number

Vehicle entity handle

wall

table

Wall polygon (array of 4 vector3 points)

Returns: boolean - true if any vehicle corner is inside the wall, false otherwise.


isPointInCircuit

Checks if a point is within the circuit boundaries (between inner and outer polygons).

Parameter
Type
Description

point

table/vector3

Point to check

inner

table

Inner circuit boundary polygon

outer

table

Outer circuit boundary polygon

Returns: boolean - true if point is inside outer but outside inner polygon, false otherwise.

Example:


Team Exports

getPlayerTeams

Gets all teams the local player belongs to.

Returns: table - Dictionary of teams {teamId = role, ...}

Example:


getPlayerTeamsWithPermission

Gets teams where the local player has a specific permission.

Parameter
Type
Description

permission

string/nil

Permission to filter by, or nil for all teams

Permission Types:

  • MANAGE_TEAM - Can edit team settings

  • MANAGE_MEMBERS - Can kick/change roles

  • MANAGE_MONEY - Can handle transactions

  • RACE - Can participate in races

Returns: table - Dictionary of teams with matching permission {teamId = role, ...}

Example:


Tyre Exports

setTyreCompound

Sets the tire compound for the current vehicle.

Parameter
Type
Description

tyres

string

Tire compound type

Tire Compound Types: (depending on config)

  • soft - High grip, fast wear

  • medium - Balanced performance

  • hard - Low grip, slow wear

  • wet - Rain conditions

Example:


getTyreCompound

Gets the currently equipped tire compound.

Returns: string - Current tire compound type.


Race Time Exports

getBestLapTime

Gets the best lap time in the current race.

Returns: number - Best lap time in milliseconds, or 0 if no laps completed.

Example:


getCurrentLapTime

Gets the elapsed time for the current lap.

Returns: number - Current lap time in milliseconds.


getTimeFromLastOutOfCircuit

Gets the time since the player last went off-track.

Returns: number or nil - Milliseconds since last off-track incident, or nil if never went off-track.


Race State Exports

getPlayerCurrentRace

Gets the track ID of the race the player is currently in.

Returns: number or nil - Track ID if in a race, nil otherwise.

Example:


getCurrentLap

Gets the current lap number.

Returns: number - Current lap number, or 0 if not racing.


disqualifyRace

Disqualifies the player from the current race.

Sets the player's race status to disqualified and prepares to leave the race.


retireRace

Retires the player from the current race.

Voluntarily removes the player from the race (counts as DNF - Did Not Finish).


HUD Exports

showHud

Shows the racing HUD overlay.

Displays the HUD with vehicle telemetry (speed, RPM, gear, etc.) and starts the sync thread.


hideHud

Hides the racing HUD overlay.

Removes the HUD from view and stops the telemetry sync.


isHudVisible

Checks if the HUD is currently visible.

Returns: boolean - true if HUD is visible, false otherwise.


Spectator/Watching Exports

getWatchingTrack

Gets the track ID the player is currently spectating.

Returns: number or nil - Track ID being spectated, or nil if not spectating.


getWatchingDriver

Gets the driver being spectated.

Returns: number or nil - Player server ID of spectated driver, or nil if not spectating anyone.


getWatchingCameraIndex

Gets the current spectator camera index.

Returns: number - Current camera angle index.


UI State Exports

isLeaderboardOpened

Checks if the race leaderboard is currently open.

Returns: boolean - true if leaderboard is displayed, false otherwise.


isInPitBox

Checks if the player is currently in the pit box.

Returns: boolean - true if player is in pit, false otherwise.

Example:


Complete Usage Example

Last updated