- Documentation
- Events
Category
Events
All Lua functions and events in the Events category, on the server and the client.
Server functions 5
cancelStops sending a latent event to a player.Latent Event getReturns the handles of latent events still being sent to a player.Latent Event Handles getReturns the progress of sending a latent event to a player.Latent Event Status triggerSends an event from the server to one player, several players or everyone at once.Client Event triggerSends an event to clients likeLatent Client Event triggerClientEvent, intended for large data sent in the background (with a bandwidth limit). Argument order:sendTo, name, [bandwidth], [persist], sourceElement, .... Progress can be checked withgetLatentEventHandlesandgetLatentEventStatus.
Client functions 1
Shared functions 10
addRegisters a custom event with the given name so it can be triggered (Event triggerEvent,triggerClientEvent,triggerServerEvent) and handled (addEventHandler). WithallowRemoteTrigger = truethe event can come from the other side of the network: on the server - from a client viatriggerServerEvent, on the client - from the server viatriggerClientEvent. Without it, events from the network are rejected, which protects the server from clients faking events.addAttaches a function to an event. This is how you react to a player joining, dying, a key press, every frame and your own events.Event Handler cancelCancels the current event from inside its handler. For events that allow it, it blocks the default action, e.g.Event onPlayerChat(the message will not appear in chat),onPickupHit(the pickup will not be collected),onVehicleStartEnter(the player will not get in). Other handlers still run and can check the state withwasEventCancelled. On the server you can give a reason, readable withgetCancelReason.getReturns the total number of functions attached to an event on all elements. Useful for finding leaks (e.g. someone addingEvent Handler Count onClientRenderevery second).getReturns the list of functions attached to an event directly on the given element (without handlers on parents).Event Handlers getReturns a sorted list of the names of all known events: built-in ones and those registered withEvent Names addEvent.isChecks whether an event with this name exists (built in or added withEvent Added addEvent).removeDetaches a function from an event. You must pass the same name, element and the same function (the same variable) as inEvent Handler addEventHandler- an anonymous function written again is a different function.triggerTriggers an event on an element on the same side (server → server, client → client). The handlers run immediately, before the function returns. The event must be registered withEvent addEventor be built in.wasChecks whether the current event was cancelled withEvent Cancelled cancelEventin an earlier handler; outside an event - whether the last event was cancelled.