1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Check players server

Discussion in 'Development' started by LucGamesDE, Mar 23, 2017.

  1. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    Is there a way to check if a player joined with the Transfer Packet onLogin?
     
  2. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    There is not. That's one thing we've noted is lacking with transfers, is that the destination server can't tell that the player was transferred.
     
    jasonwynn10 and Kyd like this.
  3. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    Ok. And do u have an idea how I could check this? I thought about something with MySQL?
     
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    very possible
    you can save transfer X player to Y server
    but it only work IF you own both server
    you cannot tell if some server you dont own transfered their player to you
     
  5. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    I want that the players only can join over my main server. How can I check this? If I only write this to a database the players could join over it, leave and join another server. But I want to block that
     
  6. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    PHP:
    Mainserver:
    onRequestJoin2ndServer:$player
    //$db should be some sort of database where both servers shares
    $db->insert($player,time());
    $player->transfer(2ndServer);

    2ndServer:
    onJoin:$player //i think there's better events for that usage, you should also set lowest priority
    $time =$db->read($player);
    if (
    $time == false){//not set yet
    $ev->setCancelled();
    $this->kickTask($player,'Please join via the main server');//using task because last time i tried there's a weird crash bug if you kick them before they joined maybe cancelled ev helps
    } elseif (time() - $time 120){
    $ev->setCancelled();
    $this->kickTask($player,'Please join again via the main server\n(Transfer timeout)');
    $db->drop($player);
    } else {
    $db->drop($player);
    $this->welcome($player);
    }
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.