KickPlayer

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

Kicks a player from the server.

Syntax

API.kickPlayer(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)

   [Command("kick", GreedyArg = true)]
   public void KickCommand(Client player, Client target, string reason)
   {
      API.kickPlayer(target, reason);
      API.sendChatMessageToAll("~h~" + target.name + "~h~ was kicked by an Admin, reason: " + reason);
   }

OOP

   [Command("kick", GreedyArg = true)]
   public void KickCommand(Client player, Client target, string reason)
   {
      target.kick(reason);
      API.sendChatMessageToAll("~h~" + target.name + "~h~ was kicked by an Admin, reason: " + reason);
   }

References