C++ Server Pawn Possession

Iv’e made it so the player can get into an already spawn vehicle like in GTA, All works well in offline mode but when i run the same function through the server it also works (it doesn’t crash) but it seems all input is blocked? and i cant control the pawn? any ideas?

Hello,

Sorry to hear about your issue.
It may occur when Possess() is called on the client. However, spawning Pawns and calling Possess() should be handled on the Server.

Please note that in the situation when Possess() is called immediately after spawning the Actor commands can get to the client in the wrong order which may cause the possesion failure.

To fix it, you can replace

if (NewPawn == NULL)
	{
		return;
	}

in APlayerController::ClientRestart_Implementation() with:

 if ( GetPawn() == NULL )
 {
     ServerCheckClientPossession();
     return;
 }

Thus, the server will be asked to verify and resend the pawn if needed.

Hope this helped!

Cheers!

My Possess() function is called by the client but is executed on the server, and my pawn i spawned at begin play. Not when i’m immediately about to possess it. Also i can’t edit any of the base code like APlayerController because there all read only file

If you want to be able to edit source, please grab UE4 from GitHub repository.

Iv’e been adding and removing code for hours and still can’t get this to work? I even asked the forums and someone told me it was an authority problem with the server but he wasn’t sure… Do you have any other ideas please, this is really starting to bug me (pun unintended)