Plutonium-IW5-Scripts/chat_commands/chat_command_invisible.gsc
2023-02-16 04:17:23 +01:00

52 lines
789 B
Plaintext

#include scripts\chat_commands;
Init()
{
CreateCommand(level.commands_servers_ports, "invisible", "function", ::InvisibleCommand, ["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();
}
else
{
player show();
}
}