BanPlayer

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

Bans the specified player from the server.

Syntax

In C#
Server-Side Function

API.banPlayer(Client player, string reason);

Required Arguments

  • player: parameter input should be in Client type.

Optional Arguments

  • reason: parameter input should be in string type.

Usage example(s)

In C#
Server-Side Function

[Command("ban", GreedyArg = true)]
public void BanCommand(Client player, Client target, string reason)
{
    API.banPlayer(target, reason);
    API.sendChatMessageToAll("~h~" + target.name + "~h~ got banned by an admin, reason: " + reason);
}
[Command("ban", GreedyArg = true)]
public void BanCommand(Client player, Client target, string reason)
{
    target.ban(reason);
    API.sendChatMessageToAll("~h~" + target.name + "~h~ got banned by an admin, reason: " + reason);
}

References