HogWarp
  • Home
    • Frequently Asked Questions
    • Supported Versions
  • Client
    • Quick start
      • Playstation Controller not working
      • Epic Games Version Saves Fix
  • Server
    • Quick Start
    • Server Requirements
    • Troubleshooting
  • Scripting
    • Getting Started
    • Client side
      • Basics
      • Setting up mods
        • Local Cooking / Building
    • Server side
      • Plugin
        • Creating a Plugin
        • Structure / Lifecycle
        • Plugin ↔ Plugin
      • Debugging
      • Event handling
      • API Documentation
        • Server
          • IPlugin
          • PlayerSystem
          • RpcManager
          • Timer
          • World
        • Game
          • Types
        • Systems
          • Logger
          • ClientRpcAttribute
          • ReplicatedAttribute
          • ServerRpcAttribute
Powered by GitBook
On this page
  • HogWarpSdk.Server.World.UpdateEvent
  • HogWarpSdk.Server.PlayerSystem.PlayerJoinEvent
  • HogWarpSdk.Server.PlayerSystem.PlayerLeftEvent
  1. Scripting
  2. Server side

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:

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.

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.

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

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

Last updated 4 months ago