Hey, can we maybe get a "canclientlogin"?
like somewhere in uLink_OnPlayerConnected
maybe after the STEAM Auth Ticket failed basic validation?
Solved CanClientLogin hook
Discussion in 'Hurtworld Development' started by Reneb, Dec 13, 2015.
-
you think this:
- OnPlayerConnected(PlayerIdentity identity, uLink.NetworkPlayer player)
-
Wulf Community Admin
@Reneb, I'll take a look.
-
Wulf Community Admin
Implemented this locally, which it will most likely be as shown below.
Code:CanClientLogin(PlayerSession session)
-
I just want to share a comment, the code below works as expected. However, the client does not get the message and loading screen hangs up.
Code:bool CanClientLogin(PlayerSession session) { return session.IsAdmin; }
-
Wulf Community Admin
-
Code:bool CanClientLogin(PlayerSession session) { if (!session.IsAdmin) { GameManager.Instance.KickPlayer(session.SteamId.ToString(), "Only admins allowed"); return false; } return true; }
-
Wulf Community Admin
-
-
See now I can get it to kick me during login, but I can't get it to work with GameManager.Instance.DisconnectPlayerSync.
This is the code I wrote to try and make it simple.
Code:static string kickReason = "Sorry, the maximum number of players are connected!";
Code:void CanClientLogin(PlayerSession session) { GameManager instance = Singleton<GameManager>.Instance; if (instance == null) return; instance.KickPlayer(session.SteamId.ToString(), kickReason); return; }
Code:void CanClientLogin(PlayerSession session) { GameManager instance = Singleton<GameManager>.Instance; if (instance == null) return; instance.DisconnectPlayerSync(session.Player, kickReason); return; }
[DOUBLEPOST=1450762452][/DOUBLEPOST]Yea looks like our only option right now is to kick the client. DisconnectPlayerSync seems to hang the client at the connecting screen until they quit through console.