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

SWTopWins

Discussion in 'Requests' started by A354-PH, Dec 21, 2018.

  1. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Does anyone have a leaderboard for gamakcz skywars?
     
  2. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    Use it API (reward code in it)
     
  3. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    What do you mean?
     
  4. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    I'm using SW_svile. It have an code (can use as API) that count player's game that they win. I think SW by GamakCZ will have the same thing like that.
     
  5. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Gimme
     
  6. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    I don't think a finished product of this exists yet, and I may work on it, but here's the API, if anyone needs it.
     
  7. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    I found this:
    PHP:

            $this
    ->pg->getServer()->loadLevel($this->world);

            
    //CLOSE SPECTATORS

            
    foreach ($this->spectators as $playerName) {

                if ((
    $s $this->pg->getServer()->getPlayer($playerName)) instanceof Player)

                    
    $this->closePlayer($s);

            }

            
    //CLOSE PLAYERS

            
    foreach ($this->players as $name => $spawn) {

                if ((
    $p $this->pg->getServer()->getPlayer($name)) instanceof Player) {

                    
    $this->closePlayer($p);

                    if (!
    $force) {

                        
    //Broadcast winner

                        
    foreach ($this->pg->getServer()->getDefaultLevel()->getPlayers() as $pl) {

                            
    $pl->sendMessage(str_replace('{SWNAME}'$this->SWnamestr_replace('{PLAYER}'$p->getName(), $this->pg->lang['server.broadcast.winner'])));

                        }

                        
    //Economy reward

                        
    if ($this->pg->configs['reward.winning.players'] && is_numeric($this->pg->configs['reward.value']) && is_int(($this->pg->configs['reward.value'] + 0)) && $this->pg->economy instanceof \svile\sw\utils\SWeconomy && $this->pg->economy->getApiVersion() != 0) {

                            
    $this->pg->economy->addMoney($p, (int)$this->pg->configs['reward.value']);

                            
    $p->sendMessage(str_replace('{MONEY}'$this->pg->economy->getMoney($p), str_replace('{VALUE}'$this->pg->configs['reward.value'], $this->pg->lang['winner.reward.msg'])));

                        }

                        
    //Reward command

                        
    $command trim($this->pg->configs['reward.command']);

                        if (
    strlen($command) > && $command{0} == '/') {

                            
    $this->pg->getServer()->dispatchCommand(new \pocketmine\command\ConsoleCommandSender(), str_replace('{PLAYER}'$p->getName(), substr($command1)));

                        }

                    }

                }

            }

            
    //Other players

            
    foreach ($this->pg->getServer()->getLevelByName($this->world)->getPlayers() as $p)

                
    $p->teleport($p->getServer()->getDefaultLevel()->getSpawnLocation());

            
    $this->reload();

            return 
    true;

        }
    You can use this.
     
  8. ZackyVN

    ZackyVN Baby Zombie

    Messages:
    150
    Send the whole function
     
  9. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    That is not at all useful, because it's for a different plugin entirely. This will not work for OP's plugin.

    How do you want the leaderboard to be displayed? Command, Floating text, etc.? I assume you want a leaderboard just for wins, and nothing else?
     
  10. A354-PH

    A354-PH Baby Zombie

    Messages:
    186
    GitHub:
    Kizu
    Nevermind. My friend made me one
     
  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.