> For the complete documentation index, see [llms.txt](https://docs.hogwarp.com/hogwarp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hogwarp.com/hogwarp/scripting/server-side/event-handling.md).

# Event handling

The server provides a few events that you can listen to.

### HogWarpSdk.Server.World.UpdateEvent

This simple event is called every frame and passes the delta time in seconds since the previous frame.

Example usage:

```csharp
public Plugin()
{
    HogWarpSdk.Server.World.UpdateEvent += MyUpdate;
}

private void MyUpdate(float Delta)
{
    // Do something
}
```

### HogWarpSdk.Server.PlayerSystem.PlayerJoinEvent

This simple event is called when a player joins the server, it passes the player, at this point all spawned actors are already valid and Rpcs can be called.

```csharp
public Plugin()
{
    HogWarpSdk.Server.PlayerSystem.PlayerJoinEvent += PlayerSystem_PlayerJoinEvent; 
}

private void PlayerSystem_PlayerJoinEvent(HogWarpSdk.Game.Player player)
{
    // Yay we have a new player!
}
```

### HogWarpSdk.Server.PlayerSystem.PlayerLeftEvent

This simple event is called when a player leaves the server, it passes the player, note that at this point it would serve no purpose to make Rpc calls to that player, they are already disconnected.

```csharp
public Plugin()
{
    HogWarpSdk.Server.PlayerSystem.PlayerLeftEvent += PlayerSystem_PlayerLeftEvent; 
}

private void PlayerSystem_PlayerLeftEvent(HogWarpSdk.Game.Player player)
{
    // Oh no a player left :'(
}
```
