chat_command_change_team 1.0.0

This commit is contained in:
Resxt 2023-02-16 04:07:00 +01:00
parent 1ac9e89578
commit 505b676e43
2 changed files with 55 additions and 0 deletions

View File

@ -24,6 +24,13 @@ Also note that this script doesn't provide any command on its own. You must inst
- Permissions/ranks to restrict some commands to a certain type of players (admin, VIP etc.) - Permissions/ranks to restrict some commands to a certain type of players (admin, VIP etc.)
- Configurable text colors/accent. As of now the majority of the text will be white - Configurable text colors/accent. As of now the majority of the text will be white
## chat_command_change_team.gsc
The player affected by the command dies and swaps to the other team.
Arguments expected: the complete name of a player.
Example: `!changteam Resxt`
## chat_command_map_mode.gsc ## chat_command_map_mode.gsc
3 related commands in one file: 3 related commands in one file:

View File

@ -0,0 +1,48 @@
#include scripts\chat_commands;
Init()
{
CreateCommand(level.commands_servers_ports, "changeteam", "function", ::ChangeTeamCommand, ["default_help_one_player"]);
}
/* Command section */
ChangeTeamCommand(args)
{
if (args.size < 1)
{
return NotEnoughArgsError(1);
}
error = ChangeTeam(args[0]);
if (IsDefined(error))
{
return error;
}
}
/* Logic section */
ChangeTeam(playerName)
{
player = FindPlayerByName(playerName);
if (!IsDefined(player))
{
return PlayerDoesNotExistError(playerName);
}
if (player.team == "axis")
{
player [[level.allies]]();
}
else if (player.team == "allies")
{
player [[level.axis]]();
}
}