mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-19 12:42:54 +00:00
chat_command_teleport 1.0.0
This commit is contained in:
parent
505b676e43
commit
3384aef34f
@ -52,6 +52,18 @@ The player who runs the command dies.
|
||||
Arguments expected: none.
|
||||
Example: `!suicide`
|
||||
|
||||
## chat_command_teleport.gsc
|
||||
|
||||
Teleports a player to another
|
||||
|
||||
Arguments expected: (1) the name of the player to teleport (2) the name of the player to teleport to.
|
||||
|
||||
| Examples |
|
||||
|---|
|
||||
| `!teleport me Eldor` |
|
||||
| `!teleport Eldor me` |
|
||||
| `!teleport Eldor Rektinator` |
|
||||
|
||||
## chat_command_text_rules.gsc
|
||||
|
||||
Prints the server rules in the player's chat.
|
||||
|
51
chat_commands/chat_command_teleport.gsc
Normal file
51
chat_commands/chat_command_teleport.gsc
Normal file
@ -0,0 +1,51 @@
|
||||
#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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user