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

BasicHUD 1.0.6

A configurable heads up display

  1. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    This does not make sense.
    Also, the provided example vars.php implement a {tops} variable. Read that, and try to understand it. Then you should be able to figure out how to create a {ranknames} or {rankpoints}. This assumes that you do know PHP.
  2. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Anyone can "know" PHP, it just depends on how much.
  3. lucasvitegui
    Offline

    lucasvitegui Active Member

    Joined:
    Apr 18, 2015
    Posts:
    191
    Minecraft User:
    lucasviteguiBR
    I know a little of C and Pascal..
    So give me a light so I can start.. can I use the same structure of "Tops" for ranknames ?
    Like it:
    http://www.docdroid.net/iaVUpZe/varsphp.txt.html
    Sorry if I am being a Noob.. I'm just trying to understand how to get These vars. Like it: https://forums.pocketmine.net/attachments/2015-06-20-17-52-35-png.6949/
  4. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    The rankings in that picture are from a LiveSigns FloatingText example.
  5. lucasvitegui
    Offline

    lucasvitegui Active Member

    Joined:
    Apr 18, 2015
    Posts:
    191
    Minecraft User:
    lucasviteguiBR
    Ok.
    But what i'm trying to do.. Show that rank using the BasicHud.. Its possible ?
  6. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Just use the {tops} variable.
  7. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    Is possible to add group/rank variables? (PurePerms).....
  8. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    You could add that as a custom variable.
  9. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
    Do u know the vars code for that? (sorry im new in php code)...
  10. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    PHP:
    if (($pp $pm->getPlugin("PurePerms")) !== null) {
      
    $vars["{group}"] = $pp->getUser($player)->getGroup()->getName();
    }
    jojoe77777 likes this.
  11. FaanMaario
    Offline

    FaanMaario Active Member

    Joined:
    Jan 4, 2015
    Posts:
    65
    Minecraft User:
    FaanMaario
    Hi,
    Thanks for your plugin, it helped me a lot !
    I'm asking if we can add variable to display how many players are on server, It's possible ?
    And also if it's possible, can you give me the vars code for that?

    Thanks :D
  12. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    PHP:
    $vars["{kount}"] = count($plugin->getServer()->getOnlinePlayers());
    FaanMaario likes this.
  13. FaanMaario
    Offline

    FaanMaario Active Member

    Joined:
    Jan 4, 2015
    Posts:
    65
    Minecraft User:
    FaanMaario
    Thanks, but it crash my server.
    I make something wrong?

    Here the crashlog:
    [="PocketMine-MP Crash Dump Tue Sep 1 13:38:33 UTC 2015 Error: Function name must be a string File: /BasicHUD_v1.0.6.phar/src/aliuly/hud/Main Line: 159 Type: E_ERROR THIS CRASH WAS CAUSED BY A PLUGIN BAD PLUGIN: BasicHUD v1.0.6 Code:
    [150] "{y}" => (int)$player->getY(),
    [151] "{z}" => (int)$player->getZ(),
    [152] "{yaw}" => (int)$player->getYaw(),
    [153] "{pitch}" => (int)$player->getPitch(),
    [154] "{bearing}" => self::bearing($player->getYaw()), [155] ] as $a => $b) {
    [156] $vars[$a] = $b;
    [157] }
    [158] $fn = $this->_getVars;
    [159] $fn($this,$vars,$player);
    [160] return $vars;
    [161] }
    [162] [163] public function defaultGetMessage($player) { [164] $n = strtolower($player->getName());
    [165] if (isset($this->sendPopup[$n])) {
    [166] // An API user wants to post a Popup...
    [167] list($msg,$timer) = $this->sendPopup[$n];
    [168] if (microtime(true) < $timer) return $msg;
    [169] unset($this->sendPopup[$n]);"]

    And here the vars.php:
    PHP:
    /*
    * This code is used to create new format variables
    *
    * The following variables are available:
    *
    * $plugin - the HUD plugin
    * $vars - array containing format variables
    * $player - current player
    */
    $pm $plugin->getServer()->getPluginManager();

    if ((
    $kr $pm->getPlugin("KillRate")) !== null) {
        if (
    version_compare($kr->getDescription()->getVersion(),"1.1") >= 0) {
            
    $vars["{score}"] = $kr->getScore($player);
            
    $ranks $kr->getRankings(3);
            if (
    $ranks == null) {
                
    $vars["{tops}"] = "N/A";
            } else {
                
    $vars["{tops}"] = "";
                
    $i 1$q "";
                foreach (
    $ranks as $r) {
                    
    $vars["{tops}"] .= $q.($i++).". ".substr($r["player"],0,8).
                                         
    " ".$r["count"];
                    
    $q "   ";
                }
            }
        }
    }
    if ((
    $mm $pm->getPlugin("PocketMoney")) !== null) {
        
    $vars["{money}"] = $mm->getMoney($player->getName());
    } elseif ((
    $mm $pm->getPlugin("MassiveEconomy")) !== null) {
        
    $vars["{money}"] = $mm->getMoney($player->getName());
    } elseif ((
    $mm $pm->getPlugin("EconomyAPI")) !== null) {
        
    $vars["{money}"] = $mm->mymoney($player->getName());
    } elseif ((
    $mm $pm->getPlugin("GoldStd")) !== null) {
        
    $vars["{money}"] = $mm->getMoney($player);
    }
    $vars["{kount}"] = count($plugin->getServer()->getOnlinePlayers());
    Last edited: Sep 1, 2015
  14. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    So, did reverting your change fix the problem?
    What kind of system are you running on? Did you see any errors on the console when the plugin loads?
    How did you create your vars.php?
  15. FaanMaario
    Offline

    FaanMaario Active Member

    Joined:
    Jan 4, 2015
    Posts:
    65
    Minecraft User:
    FaanMaario
    I've seen errors on the console, and I just took the vars-example.php and I slipped the line you gave me.

    Here the error on the console :
  16. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Exactly how did you create the vars.php? For example, if you use WordPad.exe on windows that sometimes adds junk characters on PHP files. You need to use a proper code editor.

    What kind of system are you running? For example, Android does not show all the possible errors on the console.

    Finally, you are showing the errors on the console when the crash happens (probably as soon as one player joined). My question is, did you see any errors (and if you are on Android you probably won't see any), when the plugin loaded (usually when you start the server).

    Forgot to ask, what version of BasicHUD are you running?
  17. FaanMaario
    Offline

    FaanMaario Active Member

    Joined:
    Jan 4, 2015
    Posts:
    65
    Minecraft User:
    FaanMaario
    I create vars.php with a FTP Client (Turbo Client), on my Android phone.
    My server is running with Linux, and see any errors when the plugin loaded.

    I use the latest version of BasicHUD, 1.0.6 :)
  18. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    I added this to an example vars.php:

    PHP:
    $vars["{numPlayers}"] = count($plugin->getServer()->getOnlinePlayers());
    For your convenience I included it as an attachment.

    Attached Files:

    FaanMaario likes this.
  19. GODLIKE5
    Offline

    GODLIKE5 New Member

    Joined:
    Jan 24, 2015
    Posts:
    8
    Minecraft User:
    GODLIKE5
    Hello i have kill rate 2.1.1 and i saw ur comment of

    format: "{GREEN}{BasicHUD} {WHITE}{world} ({x},{y},{z}) {bearing} {RED}EUR:{money} Pts:{score}"

    I tried this but the score didnt work. I have Kill rate 2.1.1 and GoldStd by you. Any help?
  20. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Do you have a "vars.php"? If so can you posts its contents?

Share This Page

Advertisement