mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-20 13:05:43 +00:00
chat_command_change_team 1.0.0
This commit is contained in:
parent
1ac9e89578
commit
505b676e43
@ -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.)
|
||||
- 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
|
||||
|
||||
3 related commands in one file:
|
||||
|
48
chat_commands/chat_command_change_team.gsc
Normal file
48
chat_commands/chat_command_change_team.gsc
Normal 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]]();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user