chat_command_invisible 1.0.0

This commit is contained in:
Resxt 2023-03-24 20:29:48 +01:00
parent 56a1d9e961
commit f029c48373
2 changed files with 73 additions and 0 deletions

View File

@ -119,6 +119,25 @@ Toggles whether the targeted player is in god mode (invincible) or not.
|---| |---|
| 3 | | 3 |
## chat_command_invisible.gsc
Toggles invisibility on the targeted player.
Note that this does not make the player invisible to bots in multiplayer, in the sense that even if they can't see the player, they will still know his position and shoot him.
However, in addition to being invisible, you will also be ignored by zombies in the zombies mode.
| # | Argument | Mandatory |
|---|---|---|
| 1 | The name of the player to make invisible/visible | :white_check_mark: |
| Examples |
|---|
| `!invisible me` |
| `!invisible Resxt` |
| Permission level |
|---|
| 3 |
## chat_command_permissions.gsc ## chat_command_permissions.gsc
2 related commands in one file: 2 related commands in one file:

View File

@ -0,0 +1,54 @@
#include scripts\chat_commands;
Init()
{
CreateCommand(level.chat_commands["ports"], "invisible", "function", ::InvisibleCommand, 3, array("default_help_one_player"));
}
/* Command section */
InvisibleCommand(args)
{
if (args.size < 1)
{
return NotEnoughArgsError(1);
}
error = ToggleInvisible(args[0]);
if (IsDefined(error))
{
return error;
}
}
/* Logic section */
ToggleInvisible(playerName)
{
player = FindPlayerByName(playerName);
if (!IsDefined(player))
{
return PlayerDoesNotExistError(playerName);
}
commandName = "invisible";
ToggleStatus(commandName, "Invisible", player);
if (GetStatus(commandName, player))
{
player Hide();
player.ignoreme = 1; // zombies won't target the player
}
else
{
player Show();
player.ignoreme = 0; // zombies will target the player again
}
}