mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-20 00:24:49 +00:00
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
// Made as a preventitive measure to ensure no rapid observer/spawning
|
|
//
|
|
//
|
|
|
|
package ObserverTimeout
|
|
{
|
|
|
|
function serverCmdClientMakeObserver( %client )
|
|
{
|
|
//10 second cooldown on becoming an observer
|
|
if( !%client.MakeObserverTimeout )
|
|
{
|
|
if ( isObject( Game ) && Game.kickClient != %client )
|
|
Game.forceObserver( %client, "playerChoose" );
|
|
|
|
%client.MakeObserverTimeout = true;
|
|
schedule(10000, 0, "ResetMakeObserverTimeout", %client );
|
|
}
|
|
//5 second cooldown on the notification
|
|
else if( !%client.ObserverCooldownMsgPlayed )
|
|
{
|
|
messageClient(%client, 'MsgObserverCooldown', '\c2Observer is on cooldown.' );
|
|
|
|
%client.ObserverCooldownMsgPlayed = true;
|
|
schedule(5000, 0, "ResetObserverCooldownMsgPlayed", %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;
|
|
} |