GetPlayersInRange2D: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
Line 20: Line 20:


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{ServerPlayerFunctions}}

Latest revision as of 18:33, 30 August 2020

GetPlayersInRange2D

Type: Function
Context: Server
Introduced: v1.0

Description

Gets the players in the specified range of XY in a table. An important function which replaces the use of looping through all players and then checking if they are in the specified range.

Syntax

GetPlayersInRange2D(x, y, range)

Parameters

  • x
    The X axis
  • y
    The Y axis
  • range
    The range in cm

Return Value

  • Returns a table with the player identifiers in range.

Example

for k, v in pairs(GetPlayersInRange2D(x, y, 1000)) do
        AddPlayerChat(v, "HEY YOU ARE IN THE RANGE OF THIS POINT.")
end

See also