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

TimeRanks

Discussion in 'Requests' started by QuiverlyRivalry, Sep 19, 2017.

  1. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Hi,
    In the plugin TimeRanks, something is missing.
    https://github.com/luca28pet/TimeRanks

    The thing which is missing is the command /tr check {player} too seee how much time a player is playing. Can someone add it on please ;)
    P.S, if you do please tell me how I am trying to learn to code (dont have too)!
    Thanks!
     
  2. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    It stores playtime in seconds, so you have to convert them into hours, minutes, then seconds...
    here is a link that show exactly how to do it,

    after converting, you can easily see playtime in hours, minutes and seconds
     
  3. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    I am sorry I dont gett what you mean...
     
  4. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    Time ranks plugin 'store' play time in 'seconds', so you have to convert those 'seconds' to get exact play time of a player, example: Az528: 12Hours, 19Minutes, 55Seconds
     
  5. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Yes, I understand that but doesnt the plugin have a command called /tr? I know this because on EndernationPE it has /tr check (player), to see how long he played. But on the github it has nothing mentioning with the command.
    My friend sent me this code does it help anywehre..?
    https://pastebin.com/3xad1KEc
     
  6. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    maybe... doesn't show full code
     
  7. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    PHP:
    <?php

    namespace TimeRanks;

    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\Player;

    class 
    TimeRanksCommand{

        public function 
    __construct(Main $plugin){
            
    $this->plugin $plugin;
        }

        public function 
    run(CommandSender $sender, array $args){
            if(!isset(
    $args[0])){
                
    $sender->sendMessage ("§e-= §bCastleRaid §aTimeRanks plugin §e=-");
                
    $sender->sendMessage("§e-= §aTimeRanks plugin by §cluca28pet §e=-");
                
    $sender->sendMessage("§aUse /tr check [player]");
                return 
    true;
            }
            
    $sub array_shift($args);
            switch(
    strtolower($sub)){
                case 
    "check":A
                    
    if(isset($args[0])){
                        if(!
    $this->plugin->getServer()->getOfflinePlayer($args[0])->hasPlayedBefore()){
                            
    $sender->sendMessage("§5Player§a ".$args[0]." §5never played on §aCastleRaid");
                            return 
    true;
                        }
                        if(!
    $this->plugin->data->exists(strtolower($args[0]))){
                            
    $sender->sendMessage($args[0]." §5has played less than 1 minute on §aCastleRaid");
                            
    $sender->sendMessage("§5Rank is:§a ".$this->plugin->default);
                            return 
    true;
                        }
                        
    $sender->sendMessage($args[0]." §5has played§a ".$this->plugin->data->get(strtolower($args[0]))." §5minutes on §aCastleRaid");
                        
    $sender->sendMessage("§5Rank is:§a ".$this->plugin->getRank(strtolower($args[0])));
                        return 
    true;
                    }
                    if(!
    $this->plugin->data->exists(strtolower($sender->getName()))){
                        if(!(
    $sender instanceof Player)){
                            
    $sender->sendMessage("§ePlease use §a/tr check <playername>");
                            return 
    true;
                        }
                        
    $sender->sendMessage("§5You have played less than 1 minute on §aCastleRaid");
                        
    $sender->sendMessage("§5Rank is:§a ".$this->plugin->default);
                        return 
    true;
                    }
                    
    $sender->sendMessage("§5You have played§a ".$this->plugin->data->get(strtolower($sender->getName()))." §5minutes on §aCastleRaid");
                    
    $sender->sendMessage("§5Rank is:§a ".$this->plugin->getRank(strtolower($sender->getName())));
                    return 
    true;
                break;
                default:
                    return 
    false;
            }
        }

    }
    Are you sure, works for me welp anyways ill paste it here as well..
     
  8. BluetigerESW

    BluetigerESW Spider

    Messages:
    6
    GitHub:
    bluetigeresw
  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.