So I am trying to kick unauthorized players out of the server using this method from the AGameSession class:
virtual bool KickPlayer
(
APlayerController * KickedPlayer,
const FText & KickReason
)
However, the client does not get kicked from the server when I call this function. Does anyone know why this may be the case? Note that I am calling this in the InitNewPlayer function in my server’s AGameModeBase class.
It turns out that KickPlayer returns false when called in InitNewPlayer. However, for my needs, since I needed to kick players who did not pass a certain value when calling OpenLevel through the Options parameter, I simply overrode my server’s AGameModeBase class’ PreLogin function to set the ErrorMessage parameter to any value after parsing the Options to check whether or not the player passed a specific value or not.
The documentation for the PreLogin function can be found here