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

Function

shutdown

Stops the server (resources get onResourceStop, players are disconnected). The reason goes to the server log. If the server runs under hosting with automatic restart, it will start again.

Syntax

bool shutdown([string reason = ""])

Arguments

reasonstring, optional = ""
Shutdown reason.

Differences from MTA:SA

  • These MTA:SA arguments are not here: number exitCode = 0

In MTA:SA

shutdown(string reason = "No reason specified", number exitCode = 0)

Returns

true when shutdown started.

Example

addCommandHandler("wylacz", function(player)
    if hasObjectPermissionTo(player, "function.shutdown") then
        outputChatBox("Restart serwera za 10 s", root, 255, 0, 0)
        setTimer(shutdown, 10000, 1, "restart przez " .. getPlayerName(player))
    end
end)

See also