mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-19 04:32:53 +00:00
Added permission level to CreateCommand following chat_commands 1.3.0 update [Refactor] changed level scoped ports variable following chat_commands 1.3.0 update
52 lines
792 B
Plaintext
52 lines
792 B
Plaintext
#include scripts\chat_commands;
|
|
|
|
Init()
|
|
{
|
|
CreateCommand(level.chat_commands["ports"], "invisible", "function", ::InvisibleCommand, 3, ["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();
|
|
}
|
|
} |