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

Function

setMaxPlayers

ServerServerIdentical to MTA:SA

Changes the number of server slots at runtime (1-65535). New players are rejected when the server is full; current ones are not kicked. The change lasts until the server restarts.

Syntax

bool setMaxPlayers(int slots)

Arguments

slotsint
Number of slots.

Returns

true on success.

Example

addCommandHandler("sloty", function(player, _, n)
    if hasObjectPermissionTo(player, "function.setMaxPlayers") then setMaxPlayers(tonumber(n) or 64) end
end)

See also