How to kick player with OnPlayerConnected(Network.Message packet) ? Or send a message to him (Player.SendMessage / ...)
Getting player from packet?
Discussion in 'Rust Development' started by Iv Misticos, Oct 20, 2017.
-
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.
-
[DOUBLEPOST=1508520870][/DOUBLEPOST]how 2 use ToPlayer() ? -
Wulf Community Admin
-
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; }
-
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; }
Last edited by a moderator: Oct 21, 2017 -
Wulf Community Admin