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

Check array

Discussion in 'Development' started by Remarkabless, Jan 12, 2018.

  1. Remarkabless

    Remarkabless Slime

    Messages:
    83
    GitHub:
    Remakem
    How can I add a player to an array on join and CHECK who the player is once in array.

    Also check if he is in the array
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Do you just want to check if the player has joined before? Or what do you want to do?
     
    Remarkabless likes this.
  3. Remarkabless

    Remarkabless Slime

    Messages:
    83
    GitHub:
    Remakem
    I dont need to save the player because after the game ends. I delete everything for the next set of players.

    I want to get them when they join add to an array, (team colors). Then CHECK if players are in array and set certain perms to them if they are in that array
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    https://php.net/arrays so what's wrong? Do you have questions about PHP, or what else do you want to ask? Have you tried reading the arrays documentation linked above?
     
  5. kazuya

    kazuya Slime

    Messages:
    79
    GitHub:
    xdqrknez
    Code:
    $a = array(
            "rock",
            "stone",
            "solid"
            );
            $pn = $event->getPlayer()->getName();
            if(in_array($pn, $a)){
                echo $pn . ' is in array';
                // stuf
            }
     
  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.