Afk check pop up

Results 1 to 5 of 5
  1. #1
    Apprentice Roast is offline
    MemberRank
    Mar 2016 Join Date
    13Posts

    Afk check pop up

    Good day everyone.

    I would like to get some information on AFK check pop up window.
    I know someone has made this on their server, example on Zoo it was huge success. Thus if DreameR still visits here id like to know bit more about that, like how it is made.
    Thank you.


  2. #2
    Valued Member nonosocr1986 is offline
    MemberRank
    Aug 2006 Join Date
    Planet EarthLocation
    113Posts

    Re: Afk check pop up

    i don't know if that is what you are looking for, but here is a code snippet i released a while ago for kicking an AFK leveling player (showing a warning message to the player before kicking).

    Thanks to @Darn for adding warning message and some improvments.
    Code:
    struct afk{
        int x;
        int y;
        int cd;
        bool Warning;
    };
    
    map<DWORD, afk> afkMap;
    
    void __fastcall ApplyDamage_hooked(int* thisMonster, void *_edx, int* PlayerArray, int a3, int Damage, int a5, int a6, int a7, int a8){
        auto_ptr<KPlayer> Player(new KPlayer(PlayerArray));
        auto_ptr<KServer> Server;
    
        int WarningDelay = 10;//display a warning after 10min
        int KickDelay = 15; //kick after 15min
    
        int _WarningDelay = WarningDelay * 60000;
        int _KickDelay = KickDelay * 60000;
    
        int pid = Player->GetPid();//PlayerArray[113];
        int x = Player->GetX();//PlayerArray[83];
        int y = Player->GetY();//PlayerArray[84];
        
        
        if(afkMap[pid].x != x || afkMap[pid].y != y){
            afkMap[pid].x = (x);
            afkMap[pid].y = (y);
            afkMap[pid].cd = (GetTickCount64());
            afkMap[pid].Warning = (false);
        }
    
        if(!afkMap[pid].Warning && GetTickCount64() > (afkMap[pid].cd + _WarningDelay)){
            afkMap[pid].Warning = (true);
            Player->ChatMessage("Server", "Warning, move now or get kicked in %i min.", (KickDelay - WarningDelay));
        }
        else if(afkMap[pid].Warning && GetTickCount64() > (afkMap[pid].cd + _KickDelay))
        {
            Player->Kick("You've been kicked for AFK leveling");
            Server->ConsoleWrite(TextColor::DARK_MAGENTA, "Player: %s Kicked for AFK leveling at X:%i Y:%i", Player->GetName(), Player->GetX(), Player->GetY());
            afkMap.erase(pid);
        }
        else{//Apply dmg to the Monster
            Server::CMonsterReal::ApplyDamage(thisMonster,PlayerArray,a3,Damage,a5,a6,a7,a8);
        }
    }
    
    
    
    BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ){
        auto_ptr<LunaCore> Core(new LunaCore());
        Core->Init(ul_reason_for_call, Exports::ServerSide);
        Core->Register(&(PVOID&)Server::CMonsterReal::ApplyDamage, ApplyDamage_hooked);
        return Core->Run();
    }
    
    

  3. #3
    Apprentice Roast is offline
    MemberRank
    Mar 2016 Join Date
    13Posts

    Re: Afk check pop up

    Oh. Sweet. Thank you very much. Im going to test this out, but it looks like it is the one im looking for.

    Edit:
    After closer inspection, it wasnt the the thing but principale is quite the same. It just wont create the new popup window. But this actually feels bit better than having popups :)
    Last edited by Roast; 09-03-16 at 12:19 PM.

  4. #4
    Proficient Member MrDreameR is offline
    MemberRank
    Jan 2008 Join Date
    GermanyLocation
    161Posts

    Re: Afk check pop up

    The pop up window I used is one of the systems of R3volutioNs addon.
    It is basically a notice function called boxnotice :)

  5. #5
    Apprentice Roast is offline
    MemberRank
    Mar 2016 Join Date
    13Posts

    Re: Afk check pop up

    Quote Originally Posted by MrDreameR View Post
    The pop up window I used is one of the systems of addon.
    It is basically a notice function called boxnotice :)
    Understood, but you developed it further i think. Im not entirely sure. But it worked as afk kicker aswell... :D
    Last edited by Roast; 10-03-16 at 04:57 PM. Reason: Typo correction



Advertisement