From 8a6ef33443a2922f870f7bb8dff4c1eac7485e97 Mon Sep 17 00:00:00 2001 From: Resxt <55228336+Resxt@users.noreply.github.com> Date: Wed, 30 Mar 2022 00:28:07 +0200 Subject: [PATCH] kill_players_under_map 1.0 --- small_scripts/README.md | 9 ++++ small_scripts/kill_players_under_map.gsc | 56 ++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 small_scripts/kill_players_under_map.gsc diff --git a/small_scripts/README.md b/small_scripts/README.md index 002d7fc..930d5be 100644 --- a/small_scripts/README.md +++ b/small_scripts/README.md @@ -36,6 +36,15 @@ You can find the list of perks and pro perks in [perktable.csv](https://github.c The hardcore mode replaces some game functionalities like enabling friendly fire or disabling killcams. With this script you can override the tweaks the hardcore mode brings. +## kill_players_under_map.gsc + +This is a script to kill players when they are under the map. +Some maps don't have a script to kill players under the map and they can exploit it to kill players while being under the map. +Go under the map on the barrier and check the console to get the value to check. +Then open the in-game console and type `mapname` to get the map name. +Finally simply add a to the `switch (map_name)` with the `mapname` value for the case and the `self.origin[2]` value as the returned value. + + ## kill_stuck_bots.gsc This is a temporary solution to inactive bots or bots stuck in corners on custom maps. diff --git a/small_scripts/kill_players_under_map.gsc b/small_scripts/kill_players_under_map.gsc new file mode 100644 index 0000000..eafe5bb --- /dev/null +++ b/small_scripts/kill_players_under_map.gsc @@ -0,0 +1,56 @@ +Init() +{ + out_of_map_y = GetOutOfMapValue(GetDvar("mapname")); + + level thread OnPlayerConnect(out_of_map_y); +} +OnPlayerConnect(out_of_map_y) +{ + for(;;) + { + level waittill("connected", player); + + player thread OnPlayerSpawned(out_of_map_y); + } +} + +OnPlayerSpawned(out_of_map_y) +{ + level endon("game_ended"); + self endon("disconnect"); + + for(;;) + { + self waittill("spawned_player"); + + while (true) + { + if (IsDefined(self.origin[2])) + { + Print(self.origin[2]); // Comment this line when using on your server + + if (self.origin[2] < out_of_map_y) + { + self Suicide(); + } + } + + wait 0.01; + } + } +} + +GetOutOfMapValue(map_name) +{ + switch (map_name) + { + case "mp_showdown_sh": + return -318; + + case "mp_bog": + return -766; + + default: + return -999999; + } +} \ No newline at end of file