Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check if player is VIP

Comments in 'Plugin Development' started by Primus, Apr 11, 2015.

  1. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    So i have a config.yml with following statement:



    vips:
    - PrimusLV

    And i want the plugin to check if player that triggered event/command is in vip list!
    I tried
    $tmp = $this->getConfig->getAll();
    if($n === $tmp["vips"]["$n"]){}

    It gives me this error ArrayOutOfBounds: Undefined index: PrimusLV "
  2. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Use:
    PHP:
    $this->getConfig()->get("vips");
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Will it be array?
  4. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    For that to work your file has to look like:

    Code:
    vips:
      PrimusLV: PrimusLV
    
  5. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    config.yml:
    Code:
    vips:
      - PrimusLV
    PHP:
    PHP:
    $isVIP in_array(strtolower($username),$this->getConfig()->get("vips"));
    PEMapModder, xFlare and Primus like this.
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Thank you.
    LDX likes this.
  7. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    $isVIP return true? So if i wanna check is player VIP i need to do this?
    PHP:
    if($player === $isVIP){
    }
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Of course no... Check the definition of ===
    Also you need to tell us where the VIP rank comes from. Neither we nor PocketMine can read your mind (although @shoghicp said new API plugins can read people's mind)
    Primus and LDX like this.

Share This Page

Advertisement