1. How to kick player with OnPlayerConnected(Network.Message packet) ? Or send a message to him (Player.SendMessage / ...)
     
  2. Wulf

    Wulf Community Admin

    The player may not be fully connected at that point, but you should be to get the BasePlayer from packet.connection.player as BasePlayer or maybe ToPlayer(), though I can't recall for sure as I haven't used that hook in awhile.
     
  3. packet.connection.player as BasePlayer wont work
    [DOUBLEPOST=1508520870][/DOUBLEPOST]how 2 use ToPlayer() ?
     
  4. Wulf

    Wulf Community Admin

    You'd need to take a look in Rust's Assembly-CSharp.dll or use IntelliSense in Visual Studio to see then, as I can't recall right now and don't have a reference to look up at the moment.
     
  5. If you don't want player joining the server, you can use CanClientLogin(Network.Connection connection) and return a string to reject him with a message.
    Example:
    Code:
            object CanClientLogin(Network.Connection connection)
            {
                var id = connection.userid;
                if (BlackList.Contains(id))
                {
                    return "You are in the blacklist";
                }            return null;
            }
     
  6. I need 2 use web requests, so i cant use canclientlogin because it cant wait web requests, as one of men said in other topic

    packet.connection.player is public MonoBehaviour player; as I have from decompieler and packet.ToPlayer() is MAYBE that:
    Code:
    // BaseEntity
    public virtual global::BasePlayer ToPlayer()
    {
        return null;
    }
    Hey ) can anyone any ideas?
     
    Last edited by a moderator: Oct 21, 2017
  7. Wulf

    Wulf Community Admin

    Like I said previously, the OnPlayerConnected hook likely wouldn't have a player, only that you could try. You'd instead likely need to deal with the connection, which you can get from the packet/message.