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

Get IP of multiple players

Discussion in 'Development' started by ethaniccc, Mar 9, 2020.

  1. ethaniccc

    ethaniccc Baby Zombie

    Messages:
    189
    GitHub:
    ethaniccc
    Ok, so I am making an alt finder plugin, and I have this piece of code:
    PHP:
    $players $sender->getServer()->getOnlinePlayers();
    $otherip $players->getAddress();
    I got this error in the console:
    Code:
     [Server thread/CRITICAL]: Error: "Call to a member function getAddress() on array" (EXCEPTION) in "plugins/AltFinder/src/ethaniccc/AltFinder/Main" at line 55
    Is there any way I can get the IP of multiple players at once?
    Thanks in advance!
    ~ Ethaniccc
     
  2. Gianluxx

    Gianluxx Slime

    Messages:
    94
    GitHub:
    Gianluxx
    Learn php. you are trying to get the ip of an array of players. Do it one by one with a foreach
     
  3. ethaniccc

    ethaniccc Baby Zombie

    Messages:
    189
    GitHub:
    ethaniccc
    I just realized when I was looking at other plugins. Thank you!
     
  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.