mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-19 12:42:54 +00:00
chat_commands 1.1.3
Added teleport command to teleport a player or yourself to another player or yourself !teleport me Eldor !teleport Eldor me !teleport Eldor Rektinator [Refactor] Replaced array[array.size] = value with AddElementToArray(array, value)
This commit is contained in:
parent
3d3a9c84bb
commit
73846c8cc9
@ -38,6 +38,7 @@ InitCommands()
|
|||||||
CreateCommand(level.commands_servers_ports, "mode", "function", ::ChangeModeCommand, ["Example: " + level.commands_prefix + "mode FFA_default"]);
|
CreateCommand(level.commands_servers_ports, "mode", "function", ::ChangeModeCommand, ["Example: " + level.commands_prefix + "mode FFA_default"]);
|
||||||
CreateCommand(level.commands_servers_ports, "mapmode", "function", ::ChangeMapAndModeCommand, ["Example: " + level.commands_prefix + "mapmode mp_seatown TDM_default"]);
|
CreateCommand(level.commands_servers_ports, "mapmode", "function", ::ChangeMapAndModeCommand, ["Example: " + level.commands_prefix + "mapmode mp_seatown TDM_default"]);
|
||||||
CreateCommand(level.commands_servers_ports, "changeteam", "function", ::ChangeTeamCommand, ["Example: " + level.commands_prefix + "changeteam Resxt"]);
|
CreateCommand(level.commands_servers_ports, "changeteam", "function", ::ChangeTeamCommand, ["Example: " + level.commands_prefix + "changeteam Resxt"]);
|
||||||
|
CreateCommand(level.commands_servers_ports, "teleport", "function", ::TeleportCommand, ["Example: " + level.commands_prefix + "teleport me Eldor", "Example: " + level.commands_prefix + "teleport Eldor me", "Example: " + level.commands_prefix + "teleport Eldor Rektinator"]);
|
||||||
|
|
||||||
// Specific server(s) text commands
|
// Specific server(s) text commands
|
||||||
CreateCommand(["27016", "27017"], "rules", "text", ["Do not camp", "Do not spawnkill", "Do not disrespect other players"]);
|
CreateCommand(["27016", "27017"], "rules", "text", ["Do not camp", "Do not spawnkill", "Do not disrespect other players"]);
|
||||||
@ -100,7 +101,7 @@ ChatListener()
|
|||||||
|
|
||||||
for (i = 1; i < commandArray.size; i++)
|
for (i = 1; i < commandArray.size; i++)
|
||||||
{
|
{
|
||||||
args[args.size] = commandArray[i];
|
args = AddElementToArray(args, commandArray[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// commands command
|
// commands command
|
||||||
@ -253,6 +254,21 @@ ChangeTeamCommand(args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TeleportCommand(args)
|
||||||
|
{
|
||||||
|
if (args.size < 2)
|
||||||
|
{
|
||||||
|
return NotEnoughArgsError(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
error = TeleportPlayer(args[0], args[1]);
|
||||||
|
|
||||||
|
if (IsDefined(error))
|
||||||
|
{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Logic functions section */
|
/* Logic functions section */
|
||||||
@ -291,6 +307,35 @@ ChangeTeam(playerName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TeleportPlayer(teleportedPlayerName, destinationPlayerName)
|
||||||
|
{
|
||||||
|
players = [];
|
||||||
|
names = [teleportedPlayerName, destinationPlayerName];
|
||||||
|
|
||||||
|
for (i = 0; i < names.size; i++)
|
||||||
|
{
|
||||||
|
name = names[i];
|
||||||
|
|
||||||
|
if (name == "me")
|
||||||
|
{
|
||||||
|
players = AddElementToArray(players, self);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player = FindPlayerByName(name);
|
||||||
|
|
||||||
|
if (!IsDefined(player))
|
||||||
|
{
|
||||||
|
return PlayerDoesNotExistError(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
players = AddElementToArray(players, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
players[0] SetOrigin(players[1].origin);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Error functions section */
|
/* Error functions section */
|
||||||
@ -329,3 +374,9 @@ FindPlayerByName(name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddElementToArray(array, element)
|
||||||
|
{
|
||||||
|
array[array.size] = element;
|
||||||
|
return array;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user