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

How To Get Online Players and Show That on Site

Discussion in 'Help' started by PocketMineSVMaker, Apr 6, 2020.

  1. PocketMineSVMaker

    PocketMineSVMaker Silverfish

    Messages:
    21
    Hello,

    How i Can get Online Players on Server and Show That on my site?

    please help me
     
  2. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Um, I don't know if you want anything.
    PHP:
    <?php
    use Napol\Scoreboard\Scoreboard;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\event\Listener;

    use 
    yournamefolder\Task;
    class 
    YourNameClass extends PluginBase implements Listener{
               public function 
    onEanble():{
                  
    $this->getServer()->getPluginManager()->regsiterEvents($this$this);
          
    $this->getScheduler()->scheduleRepeatingTask(new ScoreTask($this), 5);
              }
               public function 
    score(){
               foreach(
    $this->getServer()->getOnlinePlayers() as $p){
               
    $online count($this->getServer()->getOnlinePlayer());
            
    $max_online $this->getServer()->MaxPlayer();
            
    $api Scoreboard::getInstance();
             
    $scoreboard =
    $api->new($p"ObjectiveName""Your Title");
           
    $scoreboard->setLine($p1"§aOnline");
           
    $scoreboard->setLine($p2"$online/$max_online");
          }
       }
    }
    New File Name "Task.php"
    PHP:
    <?php

    namespace Yournamespace;

    use 
    pocketmine\scheduler\Task;
    use 
    YournameFolder\Yournamefile;

    Class 
    Task extends Task{

        public function 
    __construct(YournameClass $plugin){
          
    $this->plugin $plugin;
        }
      
        public function 
    onRun(int $currentTick){
          
    $this->plugin->score();
        }
    }
    Install this plugin https://github.com/NapolGamerTH/Scoreboard
     
  3. PocketMineSVMaker

    PocketMineSVMaker Silverfish

    Messages:
    21
    no, @NutXzG . i want show online olayers on my website.
     
  4. ItsKuro

    ItsKuro Creeper

    Messages:
    3
    GitHub:
    ItsKuroMG
    ya, he means create a scoreboard but the question means show all online player on website
     
  5. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    What is your site?
     
  6. PocketMineSVMaker

    PocketMineSVMaker Silverfish

    Messages:
    21
    @NTT i havent site now, but i want the way, can you tell me? are you available at telegram? Telegram: @Shayan542
     
  7. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
  8. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
  9. PocketMineSVMaker

    PocketMineSVMaker Silverfish

    Messages:
    21
    i think it want a plugin to get online players, save that on MySQL of my Host as a Variable, For example $p and i must echo $p on my site. i dont want it with form. @NTT
     
  10. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    Get count or get value?
     
  11. PocketMineSVMaker

    PocketMineSVMaker Silverfish

    Messages:
    21
  12. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    Where u want to put it in? In the plugin or a folder
     
  13. PocketMineSVMaker

    PocketMineSVMaker Silverfish

    Messages:
    21
    plugin
    a plugin that can get online players and save that on mysql. with a update task on player join and quit event
    @NTT
     
  14. PocketMineSVMaker

    PocketMineSVMaker Silverfish

    Messages:
    21
    Can you write this plugin?
     
  15. PocketMineSVMaker

    PocketMineSVMaker Silverfish

    Messages:
    21
    @NTT
     
  16. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    count($this->getServer()->getPlayers());
     
  17. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    Give me a day
     
  18. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Use Query To Show count Player Online
     
  19. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    What he wants is a plugin, so I am making it
     
  20. Provsnoobgaming

    Provsnoobgaming Baby Zombie

    Messages:
    134
    GitHub:
    provsalt
  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.