From fd0d8f3df05c149ffcda8a0a25e6e39cdb35c27e Mon Sep 17 00:00:00 2001 From: Resxt <55228336+Resxt@users.noreply.github.com> Date: Fri, 24 Mar 2023 23:39:05 +0100 Subject: [PATCH] chat_command_kick 1.0.0 --- chat_commands/README.md | 17 ++++++++++++ chat_commands/chat_command_kick.gsc | 41 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 chat_commands/chat_command_kick.gsc diff --git a/chat_commands/README.md b/chat_commands/README.md index ffdaf7e..8231f08 100644 --- a/chat_commands/README.md +++ b/chat_commands/README.md @@ -188,6 +188,23 @@ Note that this does not make the player invisible to bots in the sense that even |---| | 3 | +## chat_command_kick.gsc + +Kicks the targeted player. +Note that due to some game limitations you cannot kick the host + +| # | Argument | Mandatory | +|---|---|---| +| 1 | The name of the player to kick | :white_check_mark: | + +| Examples | +|---| +| `!kick Resxt` | + +| Permission level | +|---| +| 4 | + ## chat_command_kill.gsc The player who runs the command kills the targeted player (no matter if they're in the same team or not) diff --git a/chat_commands/chat_command_kick.gsc b/chat_commands/chat_command_kick.gsc new file mode 100644 index 0000000..250ab06 --- /dev/null +++ b/chat_commands/chat_command_kick.gsc @@ -0,0 +1,41 @@ +#include scripts\chat_commands; + +Init() +{ + CreateCommand(level.chat_commands["ports"], "kick", "function", ::KickCommand, 4, ["default_help_one_player"]); +} + + + +/* Command section */ + +KickCommand(args) +{ + if (args.size < 1) + { + return NotEnoughArgsError(1); + } + + error = KickPlayer(args[0]); + + if (IsDefined(error)) + { + return error; + } +} + + + +/* Logic section */ + +KickPlayer(playerName) +{ + player = FindPlayerByName(playerName); + + if (!IsDefined(player)) + { + return PlayerDoesNotExistError(playerName); + } + + Kick(player GetEntityNumber()); +} \ No newline at end of file