Hi, I am trying to make something like this:
Thanks.Code:foreach (BasePlayer PVPCheck in BasePlayer.activePlayerList) { if (Reynostrum is disconnected) { // do something } }
Solved If player is disconnected
Discussion in 'Rust Development' started by Reynostrum, Jan 24, 2016.
-
Wulf Community Admin
The activePlayerList is only for players that are online (active). You can check if a player is connecting by using "player.IsConnected" I believe. Visual Studio will show you this if you setup a proper project with the references to Assembly-CSharp.dll and such.
-
Something like this?
Code:if(player = null && !player.IsConnected())
-
Wulf Community Admin
-
void OnPlayerDisconnected(BasePlayer player, string reason)
{
//Do Magic
}
Rust -
Wulf Community Admin
-
Code:
if (!AtacantePVP.IsConnected())
Thanks -
Ahhhhhhhh sooo.... I have an idea!
Maybe check if player is online(Checking if player is not in that list will result in player disconnected or never connected):
Code:List<BasePlayer> onlineplayers = BasePlayer.activePlayerList as List<BasePlayer>;
-
Wulf Community Admin