From 56959057d324eceb193e89b46848026039fe93a8 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Thu, 3 Sep 2020 19:17:15 -0400 Subject: [PATCH] Different Method --- Classic/scripts/autoexec/ObserverCooldown.cs | 35 ++++++-------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/Classic/scripts/autoexec/ObserverCooldown.cs b/Classic/scripts/autoexec/ObserverCooldown.cs index 5fd1889..ac0b407 100644 --- a/Classic/scripts/autoexec/ObserverCooldown.cs +++ b/Classic/scripts/autoexec/ObserverCooldown.cs @@ -10,24 +10,23 @@ package ObserverTimeout function serverCmdClientMakeObserver( %client ) { //10 second cooldown on becoming an observer - if( !%client.MakeObserverTimeout || %client.isAdmin ) - { + %timeDif = getSimTime() - %client.observerTimeout; + %timeDif1 = getSimTime() - %client.observerMsg; + if(%timeDif > 10000 || !%client.observerTimeout || %client.isAdmin) + { if ( isObject( Game ) && Game.kickClient != %client ) Game.forceObserver( %client, "playerChoose" ); - %client.MakeObserverTimeout = true; - %client.ObserverProtectStart = getSimTime(); - schedule(10000, 0, "ResetMakeObserverTimeout", %client ); + %client.observerProtectStart = getSimTime(); + %client.observerTimeout = getSimTime(); } - //5 second cooldown on the notification - else if( !%client.ObserverCooldownMsgPlayed ) + //1 second cooldown on message + else if((%timeDif1 > 1000 || !%client.observerMsg)) { - %wait = mFloor((10000 - (getSimTime() - %client.ObserverProtectStart)) / 1000); + %wait = mFloor((10000 - (getSimTime() - %client.observerProtectStart)) / 1000); messageClient(%client, 'MsgObserverCooldown', '\c3Observer Cooldown:\cr Please wait another %1 seconds.', %wait ); - //messageClient(%client, 'MsgObserverCooldown', '\c2Observer is on cooldown.' ); - %client.ObserverCooldownMsgPlayed = true; - schedule(2000, 0, "ResetObserverCooldownMsgPlayed", %client ); + %client.observerMsg = getSimTime(); } } @@ -35,16 +34,4 @@ function serverCmdClientMakeObserver( %client ) // Prevent package from being activated if it is already if (!isActivePackage(ObserverTimeout)) - activatePackage(ObserverTimeout); - -//Allow client to become observer again -function ResetMakeObserverTimeout( %client ) -{ - %client.MakeObserverTimeout = false; -} - -//Allow a notification again -function ResetObserverCooldownMsgPlayed( %client ) -{ - %client.ObserverCooldownMsgPlayed = false; -} \ No newline at end of file + activatePackage(ObserverTimeout); \ No newline at end of file