cancelEvent
Shared
Marks the running event as cancelled. What cancelling prevents depends on the event.
bool cancelEvent([bool cancel = true, string reason = ""])
Parameters
| Name | Type | Description |
|---|---|---|
| cancel | bool | true cancels, false undoes a cancel made by an earlier handler.default true |
| reason | string | The reason, read later with getCancelReason.default "" |
Returns
true if it was marked, false if it was not called inside a handler.
Whoever triggered the event sees the result: triggerEvent returns false for a cancelled event.
Example
local banned = { ["c3f1a2"] = true }
addEventHandler("onPlayerQueue", root, function(accountId)
if banned[accountId] then
cancelEvent(true, "banned")
end
end)NoteThe event's later handlers are still called.