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

Basic Hud {faction}

Comments in 'Plugin Development' started by DroidWareWolf, Mar 2, 2016.

  1. DroidWareWolf
    Offline

    DroidWareWolf New Member

    Joined:
    Dec 27, 2015
    Posts:
    4
    Minecraft User:
    DroidWareWolf
    Can one of you make a var that will show someones faction on basic hud :) if there's already one just tell me :p
  2. XFuryMCPE
    Offline

    XFuryMCPE Active Member Plugin Developer

    Joined:
    Jun 19, 2015
    Posts:
    137
    Plugins:
    2
    Minecraft User:
    XFuriousMC
    Just modify the source and use FactionsPro's functions.

    PHP:
    $fP $this->getServer()->getPluginManager()->getPlugin("FactionsPro");
    $faction $fP->getPlayerFaction($player->getName());
    if you want to check if they're in one or not:

    PHP:
    if(!$fP->isInFaction($player->getName())){
    //player isn't in a faction
    }
    PHP:
    if($fP->isInFaction($player->getName())){
    //player is in a faction
    }
    If you want to check what their rank is:

    PHP:
    if($fP->isMember($player->getName())){
    //Player is a member
    }
    PHP:
    if($fP->isOfficer($player->getName())){
    //player is officer
    }
    PHP:
    if($fP->isLeader($player->getName())){
    //player is leader
    }
    It's pretty easy :3
    Last edited: Mar 2, 2016
    applqpak likes this.
  3. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    [ PHP ] [/ PHP ] :p
  4. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    PHP:
    $this->plugin->getPlayerFaction($player->getName());
    Your plugin doesn't have a function called getPlayerFaction... FactionsPro does. And what happens if FactionsPro isn't installed? It will crash. I think you mean
    PHP:
    $fP $this->getServer()->getPluginManager()->getPlugin("FactionsPro");
    if(
    $fP !== null){
        
    $faction $fP->getPlayerFaction($player->getName());
        
    // then whatever else you want to do
    }
    Skullex and applqpak like this.
  5. XFuryMCPE
    Offline

    XFuryMCPE Active Member Plugin Developer

    Joined:
    Jun 19, 2015
    Posts:
    137
    Plugins:
    2
    Minecraft User:
    XFuriousMC
    Sorry, it was really late while I was typing it. Fixed it
    applqpak likes this.

Share This Page

Advertisement