chat_command_teleport 1.0.0

This commit is contained in:
Resxt 2023-03-21 03:30:46 +01:00
parent 053d060536
commit cab303f26a
2 changed files with 70 additions and 0 deletions

View File

@ -70,6 +70,25 @@ set cc_permission_4 ""
- If you prefer to display information (error messages, status change etc.) in the player's chat rather than on his screen you can do that on a dedicated server. For this you need to install [t6-gsc-utils.dll](https://github.com/fedddddd/t6-gsc-utils#installation) (dedicated server only) and change `self IPrintLnBold(message);` to `self tell(message);` in the `TellPlayer` function - If you prefer to display information (error messages, status change etc.) in the player's chat rather than on his screen you can do that on a dedicated server. For this you need to install [t6-gsc-utils.dll](https://github.com/fedddddd/t6-gsc-utils#installation) (dedicated server only) and change `self IPrintLnBold(message);` to `self tell(message);` in the `TellPlayer` function
- Support for clantags was added. You can use the player names in-game or in the dvars without having to care about their clantag. The [setClantag function](https://github.com/fedddddd/t6-gsc-utils#chat) replaces the player name so additional work was required to make the script ignore the clantag - Support for clantags was added. You can use the player names in-game or in the dvars without having to care about their clantag. The [setClantag function](https://github.com/fedddddd/t6-gsc-utils#chat) replaces the player name so additional work was required to make the script ignore the clantag
## chat_command_teleport.gsc
Teleports a player to the position of another player.
| # | Argument | Mandatory |
|---|---|---|
| 1 | The name of the player to teleport | :white_check_mark: |
| 2 | The name of the player to teleport to | :white_check_mark: |
| Examples |
|---|
| `!teleport me Eldor` |
| `!teleport Eldor me` |
| `!teleport Eldor Rektinator` |
| Permission level |
|---|
| 2 |
## chat_command_unlimited_ammo.gsc ## chat_command_unlimited_ammo.gsc
Toggles unlimited ammo on the targeted player. Toggles unlimited ammo on the targeted player.

View File

@ -0,0 +1,51 @@
#include scripts\chat_commands;
Init()
{
CreateCommand(level.chat_commands["ports"], "teleport", "function", ::TeleportCommand, 2, array("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 = array(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);
}