GetDistanceBetweenPlayers

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 12:44, 4 August 2026 by QCherry (talk | contribs) (Automatyczna aktualizacja dokumentacji funkcji)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

getDistanceBetweenPlayers

Calculates the latest known 3D distance between two players.

Syntax

number getDistanceBetweenPlayers(int firstPlayerId, int secondPlayerId)

Parameters

Name Type Required Description
firstPlayerId int yes The first connected player.
secondPlayerId int yes The second connected player.

Returns

Returns the distance in metres, or false when either position is unavailable.

Examples

Send a message when two players are nearby:

local distance = getDistanceBetweenPlayers(playerId, otherPlayerId)
if distance and distance <= 10 then
    outputChatBox("The other player is nearby", playerId)
end

Notes

  • Available only in server-side resource scripts.