Different Method

This commit is contained in:
ChocoTaco1 2020-09-03 19:17:15 -04:00
parent 8f1c6849cd
commit 56959057d3

View file

@ -10,24 +10,23 @@ package ObserverTimeout
function serverCmdClientMakeObserver( %client ) function serverCmdClientMakeObserver( %client )
{ {
//10 second cooldown on becoming an observer //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 ) if ( isObject( Game ) && Game.kickClient != %client )
Game.forceObserver( %client, "playerChoose" ); Game.forceObserver( %client, "playerChoose" );
%client.MakeObserverTimeout = true; %client.observerProtectStart = getSimTime();
%client.ObserverProtectStart = getSimTime(); %client.observerTimeout = getSimTime();
schedule(10000, 0, "ResetMakeObserverTimeout", %client );
} }
//5 second cooldown on the notification //1 second cooldown on message
else if( !%client.ObserverCooldownMsgPlayed ) 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', '\c3Observer Cooldown:\cr Please wait another %1 seconds.', %wait );
//messageClient(%client, 'MsgObserverCooldown', '\c2Observer is on cooldown.' );
%client.ObserverCooldownMsgPlayed = true; %client.observerMsg = getSimTime();
schedule(2000, 0, "ResetObserverCooldownMsgPlayed", %client );
} }
} }
@ -36,15 +35,3 @@ function serverCmdClientMakeObserver( %client )
// Prevent package from being activated if it is already // Prevent package from being activated if it is already
if (!isActivePackage(ObserverTimeout)) if (!isActivePackage(ObserverTimeout))
activatePackage(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;
}