diff --git a/chat_commands/README.md b/chat_commands/README.md index 8864e1d..0d2bf62 100644 --- a/chat_commands/README.md +++ b/chat_commands/README.md @@ -89,6 +89,15 @@ Prints the server rules in the player's chat. Arguments expected: none. Example: `!rules` +## chat_command_wallhack.gsc + +Toggles wallhack (red boxes) on the targeted player + +| Examples | +|---| +| `!wallhack me` | +| `!wallhack Resxt` | + ## chat_commands.gsc The core script that holds the configuration, runs all the chat logic and holds utils function that are shared between all the `chat_command` scripts. diff --git a/chat_commands/chat_command_wallhack.gsc b/chat_commands/chat_command_wallhack.gsc new file mode 100644 index 0000000..d814d76 --- /dev/null +++ b/chat_commands/chat_command_wallhack.gsc @@ -0,0 +1,79 @@ +#include scripts\chat_commands; + +Init() +{ + CreateCommand(level.commands_servers_ports, "wallhack", "function", ::WallhackCommand, ["default_help_one_player"]); +} + + + +/* Command section */ + +WallhackCommand(args) +{ + if (args.size < 1) + { + return NotEnoughArgsError(1); + } + + error = ToggleWallhack(args[0]); + + if (IsDefined(error)) + { + return error; + } +} + + + +/* Logic section */ + +ToggleWallhack(playerName) +{ + player = FindPlayerByName(playerName); + + if (!IsDefined(player)) + { + return PlayerDoesNotExistError(playerName); + } + + commandName = "wallhack"; + + ToggleStatus(commandName, "Wallhack", player); + + if (GetStatus(commandName, player)) + { + player DoWallhack(true); + player thread ThreadWallhack(); + } + else + { + player DoWallhack(false); + player notify("chat_commands_wallhack_off"); + } +} + +ThreadWallhack() +{ + self endon("disconnect"); + self endon("chat_commands_wallhack_off"); + + for(;;) + { + self waittill("spawned_player"); + + DoWallhack(true); + } +} + +DoWallhack(enabled) +{ + if (enabled) + { + self ThermalVisionFOFOverlayOn(); + } + else + { + self ThermalVisionFOFOverlayOff(); + } +} \ No newline at end of file