From 6b9bc23449e7f772227347e5e73190298b60fec2 Mon Sep 17 00:00:00 2001 From: Resxt <55228336+Resxt@users.noreply.github.com> Date: Fri, 30 Sep 2022 21:58:59 +0200 Subject: [PATCH] Added anti_hardscope --- small_scripts/README.md | 4 ++ small_scripts/anti_hardscope.gsc | 66 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 small_scripts/anti_hardscope.gsc diff --git a/small_scripts/README.md b/small_scripts/README.md index e10adc9..f68503d 100644 --- a/small_scripts/README.md +++ b/small_scripts/README.md @@ -2,6 +2,10 @@ Simple drag and drop scripts +## anti_hardscope.gsc + +Prevent players from hardscoping + ## change_team_names.gsc Change the team names to custom names depending on the game mode diff --git a/small_scripts/anti_hardscope.gsc b/small_scripts/anti_hardscope.gsc new file mode 100644 index 0000000..7262381 --- /dev/null +++ b/small_scripts/anti_hardscope.gsc @@ -0,0 +1,66 @@ +//#include maps\mp\bots\_bot_utility; // Uncomment if using Bot Warfare + +Init() +{ + thread OnPlayerConnect(); +} + +OnPlayerConnect() +{ + for(;;) + { + level waittill("connected", player); + + // Uncomment if using Bot Warfare + /*if (!self IsBot()) + { + player thread OnPlayerSpawned(); + }*/ + + player thread OnPlayerSpawned(); // Remove/comment if using Bot Warfare + } +} + +OnPlayerSpawned() +{ + self endon("disconnect"); + + for(;;) + { + self waittill("spawned_player"); + + self.pers["allow_ads"] = true; + + self thread AntiHardscope(); + } +} + +AntiHardscope() +{ + while (true) + { + if (self PlayerAds() >= 0.75) + { + wait 0.65; + + if (self PlayerAds() >= 0.75) + { + self IPrintLn("^1Hardscoping is not allowed"); + self AllowAds(false); + self.pers["allow_ads"] = false; + } + } + else if (self PlayerAds() < 0.75 && self.pers["allow_ads"] == false && self AdsButtonPressed() == false) + { + self.pers["allow_ads"] = true; + self AllowAds(true); + } + + wait 0.01; + } +} + +IsBot() +{ + //return IsDefined(self.pers["isBot"]) && self.pers["isBot"]; // Uncomment if using Bot Warfare +} \ No newline at end of file