KickPlayer Node - Get Access to 'Kick Reason'?

How do I get access to the ‘Kick Reason’ in the Kick / Ban Player node?

When I get kicked, the Event Network Error in the Game Instance gives me a generic “Connection Lost” message and that’s it.

Thanks :smiling_face:

Hey @VelikyPanda,
I’m not entirely sure of a way to do this in Blueprint, but the BanPlayer Function in C++ takes the controller of the player you want to ban and an FText Variable for the Kick Reason. Unless it has a way for you to attach a node for the KickReason, you may only be able to access this variable within C++, or if you make your own blueprint function.

There may be plugins on the marketplace or elsewhere that do this, though.

I hope this can help you out!
-Zen

Yes, the node does have a variable called kick reason.

But how do I retrieve what the server stored in the variable in the player’s game instance once they have been kicked?

I need to show the player an error message with the kick reason.

I have an Event Network Error in the game instance which returns an ENum, but it doesn’t return the kick reason. :disappointed_relieved:

@VelikyPanda
I think you should be able to override the function in Blueprint, but since you have an Event, it may be worth converting to a function, so you can have output. You can achieve that by right-clicking on the blueprint node.

To override, if you go into your blueprints, you should be able to find the functions menu, and there is an override drop-down menu next to functions. You should be able to select override from there:

I hope this can help!
-Zen

No, you don’t understand.

I’m using the Kick Player node to kick a player from the server. The node takes in a Player Controller to kick and a Kick Reason string.

Node

Where is the Kick Reason string returned? I don’t see it in the log and the OnNetworkFailure event in the Game Instance doesn’t return it.

I want to show the player that was kicked from the server the kick reason once they return to the main menu.

I was also looking into this stuff. Looks like it is an unfinished idea from EG devs. In function KickPlayer (AGameSession) the only usage of this KickReason is KickedPlayer->ClientWasKicked(KickReason);

Then looking into PlayerController for ClientWasKicked:

PlayerController.h

/** Notify client they were kicked from the server */
UFUNCTION(Reliable, Client)
void ClientWasKicked(const FText& KickReason);


PlayerController.cpp

void APlayerController::ClientWasKicked_Implementation(const FText& KickReason)
{
}

It’s not virtual to override, so it’s impossible to do anything without changing engine source.
Ok the only possible solution that I see would be to create custom AGameSession class and override KickPlayer function - as this is virtual.

1 Like

Well, that sucks. :slightly_frowning_face: They should remove things that aren’t used so that we don’t get confused.