chat_command_kill 1.0.0

This commit is contained in:
Resxt 2023-02-19 15:09:32 +01:00
parent 0c20175902
commit d6bf08092b
2 changed files with 66 additions and 0 deletions

View File

@ -94,6 +94,19 @@ Note that this does not make the player invisible to bots in the sense that even
| `!invisible me` | | `!invisible me` |
| `!invisible Resxt` | | `!invisible Resxt` |
## chat_command_kill.gsc
The player who runs the command kills the targeted player (no matter if they're in the same team or not)
| # | Argument | Mandatory |
|---|---|---|
| 1 | The name of the player to kill | :white_check_mark: |
| Examples |
|---|
| `!kill me` |
| `!kill Resxt` |
## chat_command_map_mode.gsc ## chat_command_map_mode.gsc
3 related commands in one file: 3 related commands in one file:

View File

@ -0,0 +1,53 @@
#include scripts\chat_commands;
Init()
{
CreateCommand(level.commands_servers_ports, "kill", "function", ::KillCommand, ["default_help_one_player"]);
}
/* Command section */
KillCommand(args)
{
if (args.size < 1)
{
return NotEnoughArgsError(1);
}
error = KillPlayer(args[0]);
if (IsDefined(error))
{
return error;
}
}
/* Logic section */
KillPlayer(targetedPlayerName)
{
if (self TargetIsMyself(targetedPlayerName))
{
self Suicide();
}
else
{
player = FindPlayerByName(targetedPlayerName);
if (!IsDefined(player))
{
return PlayerDoesNotExistError(targetedPlayerName);
}
playerTeam = self.team;
self.team = "noteam"; // we change the player's team to bypass the friendly fire limitation
player thread [[level.callbackPlayerDamage]]( self, self, 2147483600, 8, "MOD_SUICIDE", self getCurrentWeapon(), (0,0,0), (0,0,0), "torso", 0 );
self.team = playerTeam; // sets the player's team to his original team again
}
}