mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-19 12:42:54 +00:00
51 lines
884 B
Plaintext
51 lines
884 B
Plaintext
#include scripts\chat_commands;
|
|
|
|
Init()
|
|
{
|
|
CreateCommand(level.commands_servers_ports, "teleport", "function", ::TeleportCommand, ["default_help_two_players"]);
|
|
}
|
|
|
|
|
|
|
|
/* Command section */
|
|
|
|
TeleportCommand(args)
|
|
{
|
|
if (args.size < 2)
|
|
{
|
|
return NotEnoughArgsError(2);
|
|
}
|
|
|
|
error = TeleportPlayer(args[0], args[1]);
|
|
|
|
if (IsDefined(error))
|
|
{
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/* Logic section */
|
|
|
|
TeleportPlayer(teleportedPlayerName, destinationPlayerName)
|
|
{
|
|
players = [];
|
|
names = [teleportedPlayerName, destinationPlayerName];
|
|
|
|
for (i = 0; i < names.size; i++)
|
|
{
|
|
name = names[i];
|
|
|
|
player = FindPlayerByName(name);
|
|
|
|
if (!IsDefined(player))
|
|
{
|
|
return PlayerDoesNotExistError(name);
|
|
}
|
|
|
|
players = AddElementToArray(players, player);
|
|
}
|
|
|
|
players[0] SetOrigin(players[1].origin);
|
|
} |