GetPlayersInRadiusOfPosition

From GT-MP
Jump to: navigation, search
GetPlayersInRadiusOfPosition
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#

This function gives a list of clients who are in the radius of the given position.

Syntax

API.getPlayersInRadiusOfPosition(float radius, Vector3 position);

Required Arguments

  • radius: parameter input should be in float type.
  • position: parameter input should be in Vector3 type.

NOTE: This function returns data in List type.

Usage example(s)

Example Description

// This command kicks all players in the radius of the given position.
[Command("kickplayersinradius")]
public void kickPlayersInRadiusCommand(Client player, float x, float y, float z, float radius)
{
    Vector3 position = new Vector3(x, y, z);
    List<Client> playerList = API.getPlayersInRadiusOfPosition(radius, position);
    foreach(Client currentPlayer in playerList)
    {
        API.kickPlayer(currentPlayer);
    }
}


References