ZStageInterface.cpp : Line : 30
Code:
void GunzAFKSystem(int LastMouseMoveTime, bool WarningOutput, bool AFK, POINT CursorPos, POINT OldCursorPos){
ZApplication::GetGameInterface()->SetState(GUNZ_STAGE);
while(1){
if(GetCursorPos(&CursorPos) && ((CursorPos.x == OldCursorPos.x) || (CursorPos.y == OldCursorPos.y)) && AFK != true){
LastMouseMoveTime = timeGetTime();
WarningOutput = true;
AFK = true;
}else if(GetCursorPos(&CursorPos) && ((CursorPos.x != OldCursorPos.x) || (CursorPos.y != OldCursorPos.y)) && AFK != false){
LastMouseMoveTime = 3600000;
WarningOutput = false;
AFK = false;
}else{
OldCursorPos = CursorPos;
}
if(LastMouseMoveTime + 30000 < timeGetTime() && WarningOutput != false){
ZChatOutput(ZCOLOR_CHAT_SYSTEM_GAME, "Warning: If you do not move the mouse in 30seconds, you will be returned to the lobby.");
WarningOutput = false;
}else if(LastMouseMoveTime + 60000 < timeGetTime() && AFK != false){
if(ZApplication::GetGameInterface()->GetState() != GUNZ_STAGE){
ZPostStageLeaveBattle(ZGetGameClient()->GetPlayerUID(), ZGetGameInterface()->GetIsGameFinishLeaveBattle());
ZPostStageLeave(ZGetGameClient()->GetPlayerUID());
AFK = false;
}else{
ZPostStageLeave(ZGetGameClient()->GetPlayerUID());
AFK = false;
}
}
if(ZApplication::GetGameInterface()->GetState() == GUNZ_LOBBY || ZApplication::GetGameInterface()->GetState() == GUNZ_NA){
break;
}
}
return;
}
ZStageInterface.cpp : Line : 244
Code:
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)GunzAFKSystem, 0, 0, 0);
Feel free to comment or like if you use or find these code useful.
WARNING: Do not use this system whit any other AFK system.
-------------------------------------------------------------------------------------------------------------
04/12/2012: Fixed crash when exiting Gunz from in-game.
04/12/2012: Code have been pre-optimized.