1. Hello, i need to find all connections to server.
    Way with foreach in BasePlayer.activePlayerList with checks - bad way, cause i need to find connection of players which are loading right now.
     
  2. Then I think your best bet would be to store all the IPs yourself, via hooks such as CanClientLogin
     
  3. Try to used, but then i need to work, like clean them after loading, but what if they will disconnect while loading? So....
     
  4. Wulf

    Wulf Community Admin

    Doesn't matter, you can still get them from there. You can also use the CanUserLogin hook and get the IP already cleaned from Oxide's Covalence API via IPlayer.Address. The Rust one just contains a port at the end.
     
  5. When i said clean, i mean:
    Easy logic - i need to check does server already have connection with same ip, but other port, so i need something like:
    foreach (var check in ListOfConnectedIP)
    if check.ipaddress.split(':')[0] == connection.blablabla && check.ipaddress.split(':')[1] != connection.blablasdf)
    then reject both.
     
  6. Wulf

    Wulf Community Admin

    Yes, or just use Covalence and avoid splitting yourself as it'd already be split and such.
     
  7. Code:
    private static string RemovePort(string address) => new Uri($"http://{address}").Host;
     
  8. sorry, i am stupid, i need to realize that:
    foreach (var check in ListOfConnectedIP)
    if check.ipaddress.split(':')[0] == connection.blablabla && check.ipaddress.split(':')[1] != connection.blablasdf)
    then reject both.

    but there are no listofconnectedip, i can find only IP of already loaded players, but i also need to get IP of players that are loading right now.
     
  9. Wulf

    Wulf Community Admin

    Connection.address is generally where the address is during CanClientLogin, or IPlayer.Address for CanUserLogin.
     
  10. yes i know how to get IP of new connection, but then i need to foreach into already connected connections xD
    But i know only how to get IP of full-loaded players.
     
  11. Wulf

    Wulf Community Admin

    There may be a queued list, but pretty sure the connected and those connecting should cover them all.