# How to declare networked functions in 4.22?

**URL:** <https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057>\
**Category:** Multiplayer & Networking\
**Tags:** Networking, unreal-engine, functions, Visual-Studio, CPP, question\
**Created:** [June 3, 2019, 11:35am UTC](https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057 "2019-06-03T11:35:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Triplexx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Triplexx](https://forums.unrealengine.com/u/Triplexx)\
**Post date:** [June 3, 2019, 11:35am UTC](https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057/1 "2019-06-03T11:35:50Z")

</div>

I didnt add my whole code here, because everything compiled well, until i add these lines. So… How can i declare server and client functions in 4.22? Everything I can google is sooo old now… 😃

In my .h

```
// - Networked Events
UFUNCTION(Server, Reliable, WithValidation)
void SetMovementInputEventServer(FVector NE_MovementInput);

```

In my .cpp

```
// - Networked Events
void AHOPCharacter::SetMovementInputEventServer(FVector NE_MovementInput)
{
	MovementInput = NE_MovementInput;
}

```

Result:

 ![278725-errors.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/1/d/91deca6a5b91db234c9671db4dfd632a870e0b53.png)

---

<div class="post-metadata">

**Author:** ![Firefly74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Firefly74](https://forums.unrealengine.com/u/Firefly74)\
**Post date:** [June 3, 2019, 12:01pm UTC](https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057/2 "2019-06-03T12:01:30Z")

</div>

your .h is fine, but in c++ you need to have it like that :

```
bool AHOPCharacter::SetMovementInputEventServer_Validate(FVector NE_MovementInput) { return true; }

 void AHOPCharacter::SetMovementInputEventServer_Implementation(FVector NE_MovementInput)
 {
     MovementInput = NE_MovementInput;
 }

```

the validate function is where you should do the check for anti cheat like behaviours

Wiki is still up to date, the only change is that “WithValidate” is now mandatory for server functions :

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![Triplexx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Triplexx](https://forums.unrealengine.com/u/Triplexx)\
**Post date:** [June 3, 2019, 1:57pm UTC](https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057/3 "2019-06-03T13:57:22Z")

</div>

Thank you for the answer!! 🙂 I already tried it, but it just underlines the function name and says, the class member doesnt have function like this… But now i copy pasted what you gave me(the same i did before) and now it doesnt complains and compiles well. Bur when i make another function exactly like you did it again underlines it… and doesnt compile

 ![278737-error2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/7/7/077be3161b9857cd71665ab287a6c30bd9b6f4cf.png)

---

<div class="post-metadata">

**Author:** ![Triplexx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Triplexx](https://forums.unrealengine.com/u/Triplexx)\
**Post date:** [June 3, 2019, 1:58pm UTC](https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057/4 "2019-06-03T13:58:20Z")

</div>

i deleted the NE\_MovementInput from the validate function

---

<div class="post-metadata">

**Author:** ![Lardo\_Deepdelver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lardo\_Deepdelver](https://forums.unrealengine.com/u/Lardo_Deepdelver)\
**Post date:** [June 5, 2019, 7:24am UTC](https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057/5 "2019-06-05T07:24:52Z")

</div>

your

```
void AHOPCharacter::SetMovementInputEventServer_Implementation()

```

has no parameter should be

```
void AHOPCharacter::SetMovementInputEventServer_Implementation(FVector NE_MovementInput)

```

on a side note you can add code easily into AnswerHub

 ![278912-answerhubcodepaste.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/d/d/3dd21fe1bb1b734127930e4ad8a243917c3ba814.png)

---

<div class="post-metadata">

**Author:** ![Firefly74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Firefly74](https://forums.unrealengine.com/u/Firefly74)\
**Post date:** [June 5, 2019, 8:50am UTC](https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057/6 "2019-06-05T08:50:13Z")

</div>

so in the end, did you succed ? note that intellisense has some hard time with UE code gen, so you should try to build even if it’s underlined in red, and output log give you way better information on the actual error ( if there is any )

---

<div class="post-metadata">

**Author:** ![Triplexx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Triplexx](https://forums.unrealengine.com/u/Triplexx)\
**Post date:** [June 6, 2019, 9:26am UTC](https://forums.unrealengine.com/t/how-to-declare-networked-functions-in-4-22/450057/7 "2019-06-06T09:26:07Z")

</div>

So in the end, it still underlines the new declarations, but it compiles succesfully. When i reload the whole project, then it doesnt underline it. 🙂 Weird
