How to get current window index in editor?

Just simple question: I have 3 players started (frist is server), how to get index player window in his context via C++?

Hello,

You could try using GetWorld->GetFirstPlayerController().

/** @return Returns the first player controller, or NULL if there is not one. */	
APlayerController* GetFirstPlayerController() const;
GetWorld->GetFirstPlayerController();

If this isn’t what you are looking for, could you please provide some more detail on exactly what you are trying to accomplish?

When I selecting in editor number of players, I want to execute different logics for each.
Server must spawn new actor.
First client must say “hello”
Second client must idle.

For example.

This is for debug purposes.
More serious case is logging in external service with different usernames and passwords. Server as admin, And clients as other specified users.

Hi Broly,

If I’m understanding correctly, you want each client to have some means to check what it’s current index is, and perform some actions based on that.

You should be able to accomplish this by having your server register players to a collection in the GameMode. It can manage this collection by creating new entries when a new PlayerController is spawned and resorting the entries when a PlayerController vanishes. Your clients can then request their index number from the server, who can look it up and respond.