ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getCancelReason

Function

getCancelReason

ServerMiscellaneousIdentical to MTA:SA

Returns the reason given in cancelEvent(true, reason) by the last event cancellation, e.g. the reason for rejecting a connection in onPlayerConnect.

Syntax

string getCancelReason()

Returns

The reason or an empty string.

Example

addEventHandler("onPlayerConnect", root, function(nick)
    if nick:find("admin") then cancelEvent(true, "Zakazany nick") end
end)
addEventHandler("onPlayerConnect", root, function()
    if wasEventCancelled() then outputServerLog("Odrzucono: " .. getCancelReason()) end
end)

See also