In C++, how to check if it's the Client or the Server that is running?

kcinkcinkcinnick
Fri, 19 Jul 2024 18:53:13 +0000
C++

Hello my fellow enthousiasts!

I am looking at the BeginPlay() of my PlayerCharacter and other Actors.

I can find lots of documentation for Blueprint, but not really for C++.

Blueprint has Kismet’s IsServer(), IsLocallyControlled() & IsLocalPlayerController().
Are there any alternatives for C++ for this?

I have found HasAuthority() which will return true when it’s the one that spawned the Object, but I don’t want to have my hopes up that it’s always going to be the server.

Is there another / better way were I can be certain that it’s actually the server and not the client?

Kind Regards,

Nick

1 post - 1 participant