Update zDarkTigerAFK.cs

This commit is contained in:
ChocoTaco 2019-06-08 14:29:01 -04:00
parent fe2ce42f7e
commit e61aa959a4

View file

@ -3,9 +3,10 @@
// //
//Client specific to save on schedules //Client specific to save on schedules
//Add clients who are normally AFK //Add clients who are normally AFK
//0 minutes disables
$dtVar::AFKtime = 60000 * 3;//if player is afk specific amount of time, force them into observer $dtVar::AFKtime = 60000 * 2;//if player is afk specific amount of time in minutes, force them into observer
$dtVar::AFKloop = 1000 * 30;//loop check timer currently set to 30 secs $dtVar::AFKloop = 1000 * 30;//loop check timer
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -16,16 +17,16 @@ function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %
{ {
Parent::onConnect( %client, %name, %raceGender, %skin, %voice, %voicePitch ); Parent::onConnect( %client, %name, %raceGender, %skin, %voice, %voicePitch );
%guid = %client.guid; if($dtVar::AFKtime > 0) //0 minutes disables
//Add clients here
%AFKWatchList1 = "";
%AFKWatchList2 = "";
%AFKWatchList3 = "";
%AFKWatchList4 = "";
if($dtVar::AFKtime > 0)
{ {
%guid = %client.guid;
//Add clients here
%AFKWatchList1 = "";
%AFKWatchList2 = "";
%AFKWatchList3 = "";
%AFKWatchList4 = "";
if(%guid $= %AFKWatchList1 || %guid $= %AFKWatchList2 || %guid $= %AFKWatchList3 || %guid $= %AFKWatchList4 ) if(%guid $= %AFKWatchList1 || %guid $= %AFKWatchList2 || %guid $= %AFKWatchList3 || %guid $= %AFKWatchList4 )
{ {
if(%guid $= "") if(%guid $= "")
@ -39,7 +40,7 @@ function GameConnection::onConnect(%client, %name, %raceGender, %skin, %voice, %
}; };
// Prevent package from being activated if it is already // Prevent package from being activated if it is already
if (!isActivePackage(afkScript)) if(!isActivePackage(afkScript))
activatePackage(afkScript); activatePackage(afkScript);
@ -48,13 +49,15 @@ if (!isActivePackage(afkScript))
function GameConnection::afkLoopCheck(%this) function GameConnection::afkLoopCheck(%this)
{ {
if(isObject(%this) && !%this.isAiControlled())// make sure client is still there other wise stop if(isObject(%this) && !%this.isAiControlled())// make sure client is still there other wise stop
%this.schedule($dtVar::AFKloop,"afkLoopCheck"); %this.schedule($dtVar::AFKloop,"afkLoopCheck");
else else
return; return;
if(isObject(%this.player) && %this.player.getState() !$= "Dead" && $matchStarted) //echo(%this.team);
AFKChk(%this);
if(isObject(%this.player) && %this.player.getState() !$= "Dead" && $matchStarted && %this.team !$= 0) //Added no check if observer
AFKChk(%this);
} }
function AFKChk(%client) function AFKChk(%client)
@ -73,7 +76,7 @@ function AFKChk(%client)
else else
{ {
//echo("is moving"); //echo("is moving");
%client.player.afkTimer = 0;//reset if moveing %client.player.afkTimer = 0;//reset if moving
} }
%client.player.curTransform = %client.player.getTransform();//save current transform %client.player.curTransform = %client.player.getTransform();//save current transform