M MY Multiplayer: Wiki
Side
Kind

cancelEvent

Shared

Marks the running event as cancelled. What cancelling prevents depends on the event.

bool cancelEvent([bool cancel = true, string reason = ""])

Parameters

NameTypeDescription
cancelbooltrue cancels, false undoes a cancel made by an earlier handler.default true
reasonstringThe 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.

See also