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

Solved Has player played before

Discussion in 'Development' started by Teamblocket, Dec 16, 2017.

  1. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    How can i check if a player is new to the server? Is their a function for this already built into PMMP?
    Here is my attempt which i haven't tested yet.

    PHP:
        /**
         * Checks if player is new to the sevrer
         *
         * @param Player $player
         * @return bool
         */
        
    public function isNew(Player $player){
            if(
    file_exists('players/'.$player->getName().'.dat')){
                return 
    true;
            }
        }
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    PHP:

    public function isNew(Player $player){
        if(
    file_exists($this->getDataPatch() . '/players/' $player->getName() . '.dat'){
               return 
    true;
       }
       return 
    false;
    }
    But there is already function hasPlayedBefore()
     
    Last edited: Dec 17, 2017
    Teamblocket likes this.
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
  4. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
  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.