ScriptRaceInit
DocsScriptRaceInit(numCheckpoints, numLaps, numPlayers, localPlayer)Description
Introduced in build 323
Initializes a script race in GTA:Online and sets up the helper split time system.
Parameters
| Name | Type | Description |
|---|---|---|
numCheckpoints | int | The total number of checkpoints in the race |
numLaps | int | The total number of laps in the race. |
numPlayers | int | The total number of players participating in the race. |
localPlayer | Player | Local player in the race. |
Quick Snippet: Get PlayerlocalPlayer
localPlayerUse this to get the local player ID or a target player's server ID.
-- Get the local player index (client-side)
local playerId = PlayerId()
-- Get the local player's server ID (for server events)
local serverId = GetPlayerServerId(playerId)
print("Player ID: " .. playerId)
print("Server ID: " .. serverId)
-- Get player ped from a server ID:
-- local targetPed = GetPlayerPed(GetPlayerFromServerId(targetServerId))Returns
voidThis native does not return a value.