GetPlayersInRange2D: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|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.}} | ||
{{FuncSyntax|GetPlayersInRange2D(x, y, range)}} | {{FuncSyntax|GetPlayersInRange2D(x, y, range)}} | ||
Line 8: | Line 8: | ||
{{FuncParam|x|The X axis}} | {{FuncParam|x|The X axis}} | ||
{{FuncParam|y|The Y axis}} | {{FuncParam|y|The Y axis}} | ||
{{FuncParam|range| | {{FuncParam|range|The range in cm}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns a table with the player identifiers in range.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang='Lua'> | |||
for k, v in pairs(GetPlayersInRange2D(x, y, 1000)) do | |||
AddPlayerChat(v, "HEY YOU ARE IN THE RANGE OF THIS POINT.") | |||
end | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{ServerPlayerFunctions}} |
Latest revision as of 18:33, 30 August 2020
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
- GetPlayerBySteamId
- SetPlayerRagdoll
- SetPlayerDimension
- GetPlayerDimension
- SetPlayerPropertyValue
- GetPlayerPropertyValue
- IsValidPlayer
- GetPlayerCount
- GetAllPlayers
- GetNearestPlayer2D
- GetPlayersInRange2D
- GetPlayersInRange3D
- GetStreamedPlayersForPlayer
- SetPlayerName
- GetPlayerName
- GetPlayerSteamId
- GetPlayerNetworkStats
- SetPlayerSpawnLocation
- IsPlayerStreamedIn
- SetPlayerVoiceRange
- SetPlayerVoiceChannel
- IsPlayerVoiceChannel
- SetPlayerVoiceEnabled
- IsPlayerVoiceEnabled
- IsPlayerTalking
- AddPlayerChat
- AddPlayerChatRange
- AddPlayerChatAll
- GetPlayerState
- GetPlayerMovementMode
- GetPlayerMovementSpeed
- IsPlayerAiming
- IsPlayerReloading
- GetPlayerVehicle
- GetPlayerVehicleSeat
- SetPlayerInVehicle
- RemovePlayerFromVehicle
- SetPlayerLocation
- GetPlayerLocation
- SetPlayerWeaponStat
- SetPlayerWeapon
- GetPlayerWeapon
- GetPlayerEquippedWeaponSlot
- EquipPlayerWeaponSlot
- GetPlayerEquippedWeapon
- SetPlayerHeading
- GetPlayerHeading
- SetPlayerSpectate
- IsPlayerDead
- SetPlayerHealth
- GetPlayerHealth
- SetPlayerArmor
- GetPlayerArmor
- SetPlayerRespawnTime
- GetPlayerRespawnTime
- GetPlayerIP
- GetPlayerPing
- KickPlayer
- GetPlayerLocale
- GetPlayerGUID
- GetPlayerGameVersion
- SetPlayerAnimation
- AttachPlayerParachute
- SetPlayerHeadSize
- GetPlayerHeadSize