GetPlayersInRadiusOfPlayer

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

Function Description


Syntax

API.getPlayersInRadiusOfPlayer(float radius, Client player);

Required Arguments

  • radius: parameter input should be in float type.
  • player: parameter input should be in Client type.

NOTE: This function returns data in List type.

Usage example(s)

Example Description

    [Command("write", GreedyArg = true)]
    public void writeMessageInRadius(Client player, string message){
        List<Client> playerList = API.getPlayersInRadiusOfPlayer(20, player);
        foreach(Client playerItem in playerList){
            API.sendChatMessageToPlayer(playerItem, player.name+" say: "+message); // The Message is only seen by players in a radius of 20 
        }
    }


References