Event Functions

Built-in functions invoked by the game:

function load() 
end

function unload() 
end

Events you can subscribe to:

  • OnUpdate()
  • OnTick()
  • OnGameLoaded()
  • OnGameUnloaded()
  • OnEntityAdded(NetEntity entity)
  • OnEntityDestroyed(NetEntity entity)
  • OnEntityUpdated(NetEntity entity, int remoteTick, double remoteTime)
  • OnPlayerChangedTeam(IPlayer player)
  • OnPlayerChatCommand(IPlayer player, string[] args)
  • OnPlayerConnected(IPlayer player)
  • OnPlayerDisconnected(IPlayer player)
  • OnPlayerIntroduced(IPlayer player)
  • OnPlayerRunCommand(IPlayer player)
  • OnHumanKilled(HumanControllable human, DamageInfo dmgInfo)
  • OnHumanSpawned(HumanControllable human)
  • OnTimerStarted(IPlayer player, FSMTimerZone zone, PlayerRun runData)
  • OnTimerCheckpoint(IPlayer player, FSMTimerZone zone, PlayerRun runData)
  • OnTimerFinished(IPlayer player, FSMTimerZone zone, PlayerRun runData)
  • OnTrickCompleted(IPlayer player, TrickCompletion completionData) : Called when the player completes a trick
  • OnTrickTrigger(IPlayer player, TouchInfo touchData) : Called when the player touches a trigger
  • OnTrickInvalidated(IPlayer player) : Called when the player's track is invalidated

Example script subscribing to OnEntityAdded:

function load() 
    Plugin:AddEvent("OnEntityAdded", on_entity_added);
end

function on_entity_added(entity)
    -- do something with entity
end