Exit Timer Callbacks#
Exit timer callbacks fire when exit timers start, update (each tick), or expire for players leaving zones.
Interface#
class ExitTimerCallback
{
// Called when an exit timer starts
// @param player - The player the timer is for
// @param zoneType - The zone type (ZONE_TYPE_PVP, ZONE_TYPE_PVE, ZONE_TYPE_RAID, ZONE_TYPE_SAFEZONE)
// @param duration - The duration of the timer in seconds
void OnExitTimerStarted(PlayerBase player, int zoneType, float duration) {}
// Called when an exit timer expires
// @param player - The player the timer expired for
// @param zoneType - The zone type
void OnExitTimerExpired(PlayerBase player, int zoneType) {}
// Called when an exit timer updates (each tick)
// @param player - The player the timer is for
// @param zoneType - The zone type
// @param remainingTime - The remaining time in seconds
void OnExitTimerUpdated(PlayerBase player, int zoneType, float remainingTime) {}
}
Zone Type Constants#
ZONE_TYPE_PVP // PvP zone
ZONE_TYPE_PVE // PvE zone
ZONE_TYPE_RAID // Raid zone
ZONE_TYPE_SAFEZONE // SafeZone
Registration#
Server-side only:
// In your mod's MissionServer.c file
modded class MissionServer
{
override void OnInit()
{
super.OnInit();
// Create and register the callback
MyTimerCallback myCallback = new MyTimerCallback();
PlayerZoneController.RegisterExitTimerCallback(myCallback);
}
}
// Define your callback class
class MyTimerCallback : ExitTimerCallback
{
override void OnExitTimerStarted(PlayerBase player, int zoneType, float duration)
{
if (!player)
return;
// Your custom logic here
// Example: Show timer UI to player
Print("[MyMod] Exit timer started: " + duration + " seconds");
}
override void OnExitTimerUpdated(PlayerBase player, int zoneType, float remainingTime)
{
if (!player)
return;
// Your custom logic here
// Example: Update timer display
}
override void OnExitTimerExpired(PlayerBase player, int zoneType)
{
if (!player)
return;
// Your custom logic here
// Example: Play sound, show notification
Print("[MyMod] Exit timer expired!");
}
}
Use Cases#
- UI Mods: Display custom exit timer countdown
- Sound Mods: Play tick sounds or warning sounds
- Notification Systems: Send timer updates to players
- Gameplay Mods: Trigger actions when timers expire