GetPlayersInRange3D: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|GetPlayersInRange3D(x, y, z, range)}} {{FuncParameters}} {{FuncParam|x|__EDIT_ME__}} {{FuncParam|y..." |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Gets the players in the specified range of XYZ 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.}} | ||
{{FuncSyntax|GetPlayersInRange3D(x, y, z, range)}} | {{FuncSyntax|GetPlayersInRange3D(x, y, z, range)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|x| | {{FuncParam|x|The X axis}} | ||
{{FuncParam|y| | {{FuncParam|y|The Y axis}} | ||
{{FuncParam|z| | {{FuncParam|z|The Z axis}} | ||
{{FuncParam|range| | {{FuncParam|range|The range}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns a table with the player identifiers in range.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang='Lua'> | |||
for k, v in pairs(GetPlayersInRange3D(x, y, z, 1000)) do | |||
AddPlayerChat(v, "HEY YOU ARE IN THE RANGE OF THIS POINT.") | |||
end | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
__EDIT_ME__ | __EDIT_ME__ |
Revision as of 15:11, 11 January 2020
Description
Gets the players in the specified range of XYZ 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
GetPlayersInRange3D(x, y, z, range)
Parameters
- x
The X axis - y
The Y axis - z
The Z axis - range
The range
Return Value
- Returns a table with the player identifiers in range.
Example
for k, v in pairs(GetPlayersInRange3D(x, y, z, 1000)) do
AddPlayerChat(v, "HEY YOU ARE IN THE RANGE OF THIS POINT.")
end
See also
__EDIT_ME__