Obj Var instead of Guid check

This commit is contained in:
ChocoTaco1 2020-11-03 16:48:44 -05:00
parent 0fef107848
commit 9707a81210

View file

@ -71,6 +71,8 @@ function GameConnection::onDrop(%client, %reason)
function DT_AFKStatusConnect(%client) function DT_AFKStatusConnect(%client)
{ {
if($dtVar::AFKtime != 0 && !$Host::TournamentMode) //0 minutes disables
{
for(%x = 1; %x <= $AFKCount; %x++) for(%x = 1; %x <= $AFKCount; %x++)
{ {
%guid = $dtVar::AFKList[%x]; %guid = $dtVar::AFKList[%x];
@ -78,18 +80,24 @@ function DT_AFKStatusConnect(%client)
{ {
$DT_AFKStatus = "ACTIVE"; $DT_AFKStatus = "ACTIVE";
$DT_AFKListCount++; $DT_AFKListCount++;
%client.dtAFK = 1;
}
} }
} }
} }
function DT_AFKStatusDrop(%client) function DT_AFKStatusDrop(%client)
{ {
for(%x = 1; %x <= $AFKCount; %x++) if(%client.dtAFK)
{
%guid = $dtVar::AFKList[%x];
if(%client.guid $= %guid && %guid !$= "")
$DT_AFKListCount = $DT_AFKListCount - 1; $DT_AFKListCount = $DT_AFKListCount - 1;
}
// for(%x = 1; %x <= $AFKCount; %x++)
// {
// %guid = $dtVar::AFKList[%x];
// if(%client.guid $= %guid && %guid !$= "")
// $DT_AFKListCount = $DT_AFKListCount - 1;
// }
if($DT_AFKListCount $= 0) //Wont set IDLE until all List Clients are off the server if($DT_AFKListCount $= 0) //Wont set IDLE until all List Clients are off the server
$DT_AFKStatus = "IDLE"; $DT_AFKStatus = "IDLE";
} }
@ -103,24 +111,20 @@ function DT_AFKtimeoutLoop()
switch$($DT_AFKStatus) switch$($DT_AFKStatus)
{ {
case ACTIVE: case ACTIVE:
if($dtVar::AFKtime != 0 && !$Host::TournamentMode) if($dtVar::AFKtime != 0 && !$Host::TournamentMode) //0 minutes disables
{ //0 minutes disables {
if($dtVar::ListOnly) if($dtVar::ListOnly)
{ {
for(%i = 0; %i < ClientGroup.getCount(); %i ++) for(%i = 0; %i < ClientGroup.getCount(); %i ++)
{ {
%client = ClientGroup.getObject(%i); %client = ClientGroup.getObject(%i);
for(%x = 1; %x <= $AFKCount; %x++) if(%client.dtAFK)
{ {
%guid = $dtVar::AFKList[%x]; if(!%client.isAIControlled() && isObject(%client.player) && %client.player.getState() !$= "Dead")
if(!%client.isAIControlled() && isObject(%client.player) && %client.player.getState() !$= "Dead" )
{
if(%client.guid $= %guid && %guid !$= "")
AFKChk(%client); AFKChk(%client);
} }
} }
} }
}
else else
{ {
for(%i = 0; %i < ClientGroup.getCount(); %i ++) for(%i = 0; %i < ClientGroup.getCount(); %i ++)