diff --git a/chat_commands/zm/README.md b/chat_commands/zm/README.md index 29f76e2..40c8905 100644 --- a/chat_commands/zm/README.md +++ b/chat_commands/zm/README.md @@ -2,6 +2,23 @@ These scripts go in `scripts\zm` +## chat_command_no_target.gsc + +Toggles whether the targeted player is in no target mode (invisible to zombies) or not. + +| # | Argument | Mandatory | +|---|---|---| +| 1 | The name of the player to toggle no target for | :white_check_mark: | + +| Examples | +|---| +| `!notarget me` | +| `!notarget Resxt` | + +| Permission level | +|---| +| 3 | + ## chat_command_points.gsc 4 related commands in one file: diff --git a/chat_commands/zm/chat_command_no_target.gsc b/chat_commands/zm/chat_command_no_target.gsc new file mode 100644 index 0000000..3be7255 --- /dev/null +++ b/chat_commands/zm/chat_command_no_target.gsc @@ -0,0 +1,45 @@ +#include scripts\chat_commands; + +Init() +{ + CreateCommand(level.chat_commands["ports"], "notarget", "function", ::NoTargetCommand, 3, array("default_help_one_player"), array("ignoreme", "ignore")); +} + + + +/* Command section */ + +NoTargetCommand(args) +{ + if (args.size < 1) + { + return NotEnoughArgsError(1); + } + + error = ToggleNoTarget(args[0]); + + if (IsDefined(error)) + { + return error; + } +} + + + +/* Logic section */ + +ToggleNoTarget(playerName) +{ + player = FindPlayerByName(playerName); + + if (!IsDefined(player)) + { + return PlayerDoesNotExistError(playerName); + } + + commandName = "notarget"; + + ToggleStatus(commandName, "No Target", player); + + player.ignoreme = GetStatus(commandName, player); +} \ No newline at end of file