# callback\_ReceivedEvent

After a successful event send on your server, the callback function **callback\_ReceivedEvent()** is called. So under Scripts/Rocket Networking/Callback Functions , you can edit this to do whatever you want…

### Example Implementation of callback

<figure><img src="https://1224219250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvYO9I4EKmgDF783aI7J4%2Fuploads%2FC6uPF4wdUL3RY78EMqT6%2Fimage.png?alt=media&#x26;token=0900ce8e-1494-4558-a0cd-121c349767b7" alt=""><figcaption></figcaption></figure>

* In a shooter game, if you hit another player, you want to inform them that their health reduced right?
* You can send an event with the eventName "damage"
* And in the message struct you can put some specifics, like how much damage should be dealt
* The receiver can see the message and use the switch statement to reude their player's health by whatever is asked in the messageStruct, and also get the attacker's name directly.

```
function callback_ReceivedEvent(eventName, theMessageStruct , senderClientId){
	switch(eventName){
	
	
		case "damage":   
		health -= theMessageStruct.damageDealt ;
		show_message("You were attached by "+ theMessageStruct.attackerName)
		break;
	
	}

}
```
