mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-09-04 07:37:26 +00:00
chat_command_change_team 1.0.0
This commit is contained in:
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]]();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user