From a20cff1fe0b0088cece179ff1f609a8c54a636fb Mon Sep 17 00:00:00 2001 From: Chase Hall Date: Mon, 7 Dec 2020 02:52:59 +0000 Subject: [PATCH] Add 'IW4x/userraw/scripts/fpsboost.gsc' --- IW4x/userraw/scripts/fpsboost.gsc | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 IW4x/userraw/scripts/fpsboost.gsc diff --git a/IW4x/userraw/scripts/fpsboost.gsc b/IW4x/userraw/scripts/fpsboost.gsc new file mode 100644 index 0000000..1a4a7ba --- /dev/null +++ b/IW4x/userraw/scripts/fpsboost.gsc @@ -0,0 +1,64 @@ +#include common_scripts\utility; +#include maps\mp\_utility; +#include maps\mp\gametypes\_hud_util; + + +init() +{ + level thread onPlayerConnect(); +} + +onPlayerConnect() +{ + for(;;) + { + level waittill( "connected", player ); + + if( !isDefined( player.message_shown) ) + player.message_shown = 0; + + if( !isDefined( player.cur_bright ) ) + player.cur_bright = 0; + + player thread watchButton(); + player thread onPlayerSpawned(); + } +} + +onPlayerSpawned() +{ + self endon("disconnect"); + + for(;;) + { + self waittill("spawned_player"); + + if( !self.message_shown ) { + self.message_shown = 1; + self iPrintlnBold( "^7Press ^3[{+actionslot 1}] ^7for fullbright." ); + } + + // Workaround for nightvision, this is very importanto! + self _SetActionSlot( 1, "" ); + } +} + +watchButton() +{ + self endon("disconnect"); + + self notifyOnPlayerCommand( "fpsboost", "+actionslot 1" ); + + for(;;) { + self waittill( "fpsboost" ); + + self.cur_bright = !self.cur_bright; + self setClientDvar( "r_fullbright", self.cur_bright ); + + if( self.cur_bright ) + self iPrintlnBold( "^7^3On" ); + else + self iPrintlnBold( "^7^3Off" ); + } + +} \ No newline at end of file