diff --git a/small_scripts/README.md b/small_scripts/README.md index 5a42157..2ffe30b 100644 --- a/small_scripts/README.md +++ b/small_scripts/README.md @@ -57,6 +57,14 @@ This checks for bots kills and deaths every 30 seconds. If they didn't do any ki Obviously a better way to do this would be checking for their positions or removing bad spawns on the map or creating waypoints for the map. This is just a quick temporary solution that works for me. +## remove_heavy_weapon_slow.gsc + +Set back your speed scale to default whenever you have an heavy weapon equipped. +Whenever you have an LMG gun or heavy sniper like a Barrett your speed will be slower than with most weapons. +This script makes it so that no matter the weapons you have in your class your speed will be normal/default. +The script doesn't modify the player's speed, instead it modifies the speed scaling (sets it back to 1) so it's safe to use with modified `g_speed`. +The speeds were tested/monitored with this [speed meter script from quaK](https://github.com/Joelrau/IW5p_DeathRun/blob/aaa9a4231d338b765d8b0fc8b06825b3a6d2a413/plugins/simplevelometer.gsc) + ## show_text_on_first_spawn.gsc Display a text to a player when it's the first time he spawns in a match. diff --git a/small_scripts/remove_heavy_weapon_slow.gsc b/small_scripts/remove_heavy_weapon_slow.gsc new file mode 100644 index 0000000..d67f1b6 --- /dev/null +++ b/small_scripts/remove_heavy_weapon_slow.gsc @@ -0,0 +1,52 @@ +#include maps\mp\_utility; + +Init() +{ + InitRemoveHeavyWeaponSlow(); +} + +InitRemoveHeavyWeaponSlow() +{ + level thread OnPlayerConnect(); +} + +OnPlayerConnect() +{ + for(;;) + { + level waittill("connected", player); + + player thread OnPlayerSpawned(); + } +} + +OnPlayerSpawned() +{ + self endon("disconnect"); + + for(;;) + { + self waittill("changed_kit"); + + self SetMoveSpeedScale(1); + + self thread OnPlayerWeaponSwitch(); + } +} + +/* +The move speed scale is reset whenever we switch weapons so we need to re-apply it on weapon change +*/ +OnPlayerWeaponSwitch() +{ + self endon("disconnect"); + + for (;;) + { + self waittill( "weapon_change", newWeapon ); + + wait 0.05; // For some reason this is needed otherwise when you fully stop and switch weapon it won't apply + + self SetMoveSpeedScale(1); + } +} \ No newline at end of file