I am trying to call a server function with parameters but I am not sure how to do it.
I am learning networking and this is like my first tests on it.
.h
UFUNCTION(reliable, server, WithValidation)
void ServerHitBlaBla(UPrimitiveComponent* PrimitiveComp, FVector Direction, FVector Location);
.cpp
void APSETPCCharacter::ServerHitBlaBla_Validate(UPrimitiveComponent* PrimitiveComp, FVector Direction, FVector Location)
{
return true;
}
void APSETPCCharacter::ServerHitBlaBla_Implementation(UPrimitiveComponent* PrimitiveComp, FVector Direction, FVector Location)
{
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Red, "Works");
PrimitiveComp->AddImpulseAtLocation(((Direction / (Direction.Size() / 1000)) * 500), Location);
}
This shows error. Basically when this is a basic firing test I am doing. When my targets hits something I want to move it with an impulse in both clien and server
I am calling this functions with something like this.
if (Role < ROLE_Authority)
{
ServerHitBlaBla(PrimitiveComp, SecondTraceDirection, FirstTraceEnd);
}
I am sure this is not how it is done but i am just testing it.