UBlueprintFunctionLibrary UServerPlayers
Description
This class will store basic player information and it will find player info by id or player controller. To get the player controller of a client on the server you need to do a lot of things, therefore its easier for us to distribute id to client side and when client needs RPC commands we can just use the id.
What does it do?
Stores player information.
How to use?
Register a player using AddNewPlayer, now you can use search and update.
Static Public Member Functions
Register a new player info on the server.
static FPlayerInfo_SQ AddNewPlayer (APlayerController *ServerController=nullptr, FString PlayerName=FString(TEXT("")), FString PlayerIP=FString(TEXT("")), ETeams_SQ Team=ETeams_SQ::Team_A, AActor *ServerCharacter=nullptr, EQueuePrivileges Privileges=EQueuePrivileges::Regular, bool SetControllerID=true)
Settings for join slots and other. Add this to Begin Play in Game Mode.
static void SlotsSettings (FServerSettings Setting)
Remove Player info using controller.
static bool RemovePlayerByController (APlayerController *Controller)
Remove Player info using player id.
static bool RemovePlayerByID (FString PlayerID)
Find player info using player id.
static void FindByID (FString PlayerID, FPlayerInfo_SQ &PlayerInfo)
Get count of all registered players.
static void PlayerCount (int32 &PlayerCount, bool ExcludeJoinQueue=true)
Get count of all registered admins.
static void AdminCount (int32 &AdminCount)
Find player info using Player Controller.
static void FindByController (APlayerController *Controller, FPlayerInfo_SQ &PlayerInfo)
Update player info.
static void UpdatePlayer (FString PlayerID, FUpdatePlayerInfo UpdateList, FPlayerInfo_SQ &Updated)
static void GetPlayerIPAddress (APlayerController *PlayerController, FString &IPAddress)
static void Kick (UObject *WorldContextObject, APlayerController *PlayerController, bool RemovePlayerRecord=true, FString KickMessage=FString(TEXT("Kick.")))
Static Public Attributes
static FTimerHandle DelayedKickTimer
static FServerSettings ServerSettings
Static Protected Member Functions
static bool RemovePlayer (APlayerController *Controller=nullptr, FString PlayerID=FString(TEXT("")))
static FPlayerInfo_SQ Find (APlayerController *Controller=nullptr, FString PlayerID=FString(TEXT("")))
static int32 NextPlayerNum ()
static bool CheckIfPlayerNumIsAvailible (int32 Number)
static int32 SolveNextPlayerNumber ()
Static Protected Attributes
static TArray< FPlayerInfo_SQ > Players
static TArray< FPlayerNumber > PlayerNumbers
static FPlayerInfo_SQ emptyInitReadyPI
Bugs
Future Features
- Saving the id automatically to client when new player is registered.
- Function to get the id on client.
Random Info
- In the Demo Project there are several times in beginplay a looping id check, it takes a small delay before that id is received. If you have something in beginplay where you need that id just make sure to check that its not empty.
- The id is a 32 characters long string.