Download

my function with property "WithValidate" giving me problem

.h


UFUNCTION(Server, Reliable,WithValidation,BlueprintAuthorityOnly,Category = DataBase)
		void checkUser(const FString& name,const FString& pass,int32 StoreID);

.cpp


void AMySQLInitializeGameMode::checkUser_Implementation(const FString& name, const FString& pass, int32 StoreID){
      //somecode
}

bool AMySQLInitializeGameMode::checkUser_Validate(FString name, FString pass, int32& StoreID)
{
	if (name != NULL || name != "" && pass != NULL || pass != "" && StoreID == NULL){
		return true;
	}
	return false;
}


i follow what documentation done, but hence
I’m still having a compile error:

error C2511: ‘bool AMySQLInitializeGameMode::checkUser_Validate(FString,FString,int32 &)’ : overloaded member function not found in ‘AMySQLInitializeGameMode’

The documentation also wrote this:
"A more recent change was added to UHT to require client->server RPC’s to have a _Validate function. This is to encourage secure server RPC functions, and to make it as easy as possible for someone to add code to check each and every parameter to be valid against all the known input constraints. "

But i have no idea what is that

can i have some help with this?

thanks in advance:)

I noticed that the parameter signature of the Validate version ( FString name, FString pass, int32& StoreID ) doesn’t match the implementation version (missing const, and using a reference for the last parameter). Could this be the issue?

Hi WindLegend,

I noticed that the Validate function parameter signature (const FString& name, const FString& pass, int32 StoreID) doesn’t match the implementation version (missing const, and using a reference for last parameter). Could this be the issue?

Oh! thx for pointing out the problem, silly mistake