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

BasicHUD Variables

Discussion in 'Plugin Help' started by Atomization, Feb 17, 2018.

  1. Atomization

    Atomization Baby Zombie

    Messages:
    120
    GitHub:
    iAtomPlaza
    how can i configure FactionPro and PureChat to show faction name {faction} and rank names {rank}
     
  2. Atomization

    Atomization Baby Zombie

    Messages:
    120
    GitHub:
    iAtomPlaza
    Nvm, i figured out how to show faction names with the var {faction} :) and i added a thing to it so it only shows if your in a faction
    PHP:
    if (($fp $pm->getPlugin("FactionsPro")) !== null) {
        if(!
    $fp->isInFaction($player->getPlayer())){
            
    $vars["{faction}"] = $fp->getPlayerFaction($player->getName());
        }
    }
     
    OnTheVerge likes this.
  3. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
    Mark this as "Solved" :)
     
  4. Atomization

    Atomization Baby Zombie

    Messages:
    120
    GitHub:
    iAtomPlaza
    not yet... how do i create a var to display purechat groups with {rank}?
     
  5. SleepSpace9

    SleepSpace9 Slime

    Messages:
    78
    GitHub:
    sleepspace9
    If you want the formated string as you defined in PureChats config.yml you will need to extract the rank from "nametag" or "chat" contents because PureChat doesn't have an extra setting for only the rank.

    When you have the nametag you could remove the display name from the end by using string operations.
    (Note: This will only work correctly if all of your nametag definitions are ending with "... {display_name}".

    You could try this (not tested!):

    PHP:
    if (($pp $pm->getPlugin("PurePerms")) !== null) {
        
    $levelName $player->getLevel()->getFolderName();
        
    $group $pp->getUserDataMgr()->getGroup($player$levelName);
        if ((
    $pc $pm->getPlugin("PureChat")) !== null) {
            
    $nameTag $pc->getConfig()->getNested("groups." $group->getName() . "worlds.$levelName.nametag");
            
    $displayName $player->getDisplayName();
            if(
    substr($nameTag,-strlen($displayName))===$displayName){
                
    $groupName substr($nameTag0strlen($nameTag)-strlen($displayName)); // will probably still contain a blank at the end
                
    $vars["{rank}"] = trim($groupName);
            } else {
                
    $vars["{rank}"] = $group->getName();
            }
        } else {
            
    $vars["{rank}"] = $group->getName();
        }
    }
    If it's enough for you to get the plain unformated rank you could try this (not tested!):
    :
    PHP:
    if (($pp $pm->getPlugin("PurePerms")) !== null) {
        
    $group $pp->getUserDataMgr()->getGroup($player$player->getLevel()->getFolderName());
        
    $vars["{rank}"] = $group->getName();
    }
    I would recommend to cache the retrieved rank and let BasicHUD read it from cache because the popup task will execute this script probably every second for every player.
     
    Last edited: Feb 20, 2018
    MC ATECH likes this.
  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.