getDistance

Calculates distance between player and a location.

Parameters:

  • source (number): Player server ID

  • location (table): Location with x, y, z coordinates

Returns:

  • number: Distance in game units

Example Use Case

if ps.getDistance(source, vector3(200.00, 300.00, 23.4) >= 3.5 then
    print(ps.getPlayerName(source) .. ' is too far to be doing this!')
end

Last updated