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

Change player to Name

Discussion in 'Development' started by Hoyee, Jun 3, 2020.

  1. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    PHP:
    function Star(){

          
    $all $this->getServer()->getOnlinePlayers();

            
    $one $all[array_rand($all)];

            foreach(
    $this->getServer()->getOnlinePlayers() as $every){

            
    $every->sendMessage("§l§dThe Player is {$one}");

          }

          }

    When I use and try this code in my server, It shows with Player(1) like this. So How can I change Player(1) to Player's name?
     
  2. BenMenEs

    BenMenEs Creeper

    Messages:
    5
    maybe you should to use getName()
     
  3. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    Oh I didn't think about that thanks
     
  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.