Concepts/Events_are_plain_global_functions
Define a function with an event's exact name at the top level of your script and the engine calls it. If you do not define it, nothing happens. You never register it. Parameters are passed in the documented order; a handler may declare fewer parameters than are passed but not more.
function onPlayerDeath(player, reason) // called by the server
{
Message(player.Name + " died (" + GetWeaponName(reason) + ")");
}Events that return a value (onPlayerChat, onPlayerRequestSpawn) use the return: false or 0 blocks, anything else (or no return) allows.
A script error inside a handler is printed and the handler stops; the server keeps running.
Categories: Core concepts