Skip to main content

AddEventHandler

Adds an event handler to the provided event.

Syntax

AddEventHandler event_name callback

Arguments

NameRequiredTypeDescription
event nameYesAn in-game event e.g. RoundStarted (found using command 'serhelp events')
callbackYesA name of a function defined above e.g. MyFunction

Details

This is a simplified version of the event handling system. It is recommended to use the '!-- OnEvent' flag when possible. Additionally, the variables are NOT going to be added via the arguments defined on the function, but automatically (like in the '!-- OnEvent' flag) - this is due to a technical limitation.

On a running server

Use serhelp AddEventHandler to inspect the reference generated by your installed SER version.