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,25 +71,33 @@ function GameConnection::onDrop(%client, %reason)
function DT_AFKStatusConnect(%client) function DT_AFKStatusConnect(%client)
{ {
for(%x = 1; %x <= $AFKCount; %x++) if($dtVar::AFKtime != 0 && !$Host::TournamentMode) //0 minutes disables
{ {
%guid = $dtVar::AFKList[%x]; for(%x = 1; %x <= $AFKCount; %x++)
if(%client.guid $= %guid && %guid !$= "")
{ {
$DT_AFKStatus = "ACTIVE"; %guid = $dtVar::AFKList[%x];
$DT_AFKListCount++; if(%client.guid $= %guid && %guid !$= "")
{
$DT_AFKStatus = "ACTIVE";
$DT_AFKListCount++;
%client.dtAFK = 1;
}
} }
} }
} }
function DT_AFKStatusDrop(%client) function DT_AFKStatusDrop(%client)
{ {
for(%x = 1; %x <= $AFKCount; %x++) if(%client.dtAFK)
{ $DT_AFKListCount = $DT_AFKListCount - 1;
%guid = $dtVar::AFKList[%x];
if(%client.guid $= %guid && %guid !$= "") // for(%x = 1; %x <= $AFKCount; %x++)
$DT_AFKListCount = $DT_AFKListCount - 1; // {
} // %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,36 +111,32 @@ 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)
{ {
for(%i = 0; %i < ClientGroup.getCount(); %i ++) if($dtVar::ListOnly)
{ {
%client = ClientGroup.getObject(%i); for(%i = 0; %i < ClientGroup.getCount(); %i ++)
for(%x = 1; %x <= $AFKCount; %x++) {
{ %client = ClientGroup.getObject(%i);
%guid = $dtVar::AFKList[%x]; if(%client.dtAFK)
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);
}
}
}
else
{
for(%i = 0; %i < ClientGroup.getCount(); %i ++)
{
%client = ClientGroup.getObject(%i);
if(!%client.isAIControlled() && isObject(%client.player) && %client.player.getState() !$= "Dead")
AFKChk(%client); AFKChk(%client);
} }
} }
} }
} case IDLE:
else //Do Nothing
{
for(%i = 0; %i < ClientGroup.getCount(); %i ++)
{
%client = ClientGroup.getObject(%i);
if(!%client.isAIControlled() && isObject(%client.player) && %client.player.getState() !$= "Dead")
AFKChk(%client);
}
}
}
case IDLE:
//Do Nothing
} }
if(isEventPending($dtVar::AFKloopSchedule)) if(isEventPending($dtVar::AFKloopSchedule))