Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Possible to kick players and/or set player limit?

As the title states I'm looking for how I can limit the amount of players on a networked server. I would assume that you're able to set the player limit somewhere but I haven't managed to find anything like that yet. And also is it possible to kick a player that's currently connected to the server (disconnect them from the server)? I'm solely using Blueprints currently.


Product Version: Not Selected
more ▼

asked Jan 24 '15 at 05:14 PM in Blueprint Scripting

avatar image

5 4 4 7

avatar image Bariudol Jan 25 '15 at 06:43 PM

I Have the exact same question, did you find a solution?

avatar image Symphonym Jan 25 '15 at 08:10 PM

Nope, not yet

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey, have a look at this:


Though i think it is not yet blueprintcallable. Try call it from the GameSession. There is also a BanPlayer function in the GameSession class. Check Github to see more.

GameSession also has a variable called "MaxPlayers" which should be available in blueprints (:

more ▼

answered Jan 25 '15 at 08:47 PM

avatar image

6.9k 333 186 472

avatar image Bariudol Jan 25 '15 at 10:22 PM

Wow, thantks!

avatar image MADHOUSE Jan 31 '17 at 08:49 PM

Is there still no way of kicking players from a server from blueprints? Anyone ever made a plugin or something to add this function call?

avatar image eXi Jan 31 '17 at 08:54 PM

It could be that the AdvancedSession plugin supports it. The other way, which I follow when I have BP only projects, is to simply identify the Player (via PlayerState and PlayerController) on the Server and then call a ClientRPC on his PlayerController "Client_KickPlayer" which simply lets the client perform a travel to the MainMenu, while destroying his session.

Means you simply force him to leave.

The ClientRPC must be created by yourself of course.

avatar image MADHOUSE Jan 31 '17 at 09:10 PM

It would seem a temporary solution tho, if you get problems with hackers in your game for example, asking the hacking client to leave is a bad idea and the server should close the connection.

Im going to try and research some better solution. AdvancedSession does not expose this functionality unfortunately.

avatar image eXi Jan 31 '17 at 09:15 PM

The GameSession "KickPlayer" method is doing the same thing. It destroys the Pawn of the Player and calls "ClientWasKicked(const FText& KickReason)" on the passed PlayerController, which is also a ClientRPC. Then it also destroys the passed PlayerController itself.

"ClientWasKicked" does actually nothing though. It's implementation in the PlayerController is empty.

The KickPlayer function of the GameSession does this here:

 bool AGameSession::KickPlayer(APlayerController* KickedPlayer, const FText& KickReason)
     // Do not kick logged admins
     if (KickedPlayer != NULL && Cast<UNetConnection>(KickedPlayer->Player) != NULL)
         if (KickedPlayer->GetPawn() != NULL)
         if (KickedPlayer != NULL)
         return true;
     return false;

So you should be good to go by just copying this with Blueprint Nodes the way I told you.

avatar image MADHOUSE Jan 31 '17 at 09:48 PM

Thanks for your reply! Interesting that their kick function would rely on the client complying with that command.

It seems like the only way to accomplish this in UE4 at the moment though without modifications to the source. I'll probably post a feature request later and keep looking for a better solution in the future.

Thanks for helping out investigating this. Best Regards

avatar image Hiengs2702 Dec 01 '17 at 06:00 AM

Kick Function in Game session does not rely on the client, Game session only exit on Server. U can expose the Function Kick Player to Blueprint, and then, in Game mode Class, make an array of player controller when post login and check when u want to kick that player, call that function and pass the controller u want to kick out of your server. Thats simple.

avatar image eXi Dec 01 '17 at 10:28 AM

Or you just do the same via Blueprint, as the GameSession version, as already explained, calls ClientWasKicked, which in the end does nothing. A simple ClientRPC on the PlayerController that connects which disconnects him is enough. Together with destroying Pawn and PlayerController of the Player (like it's done in the GameSession function) and you have your Blueprint only solution.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question