setMaxPlayers | Multi Theft Auto: Wiki Skip to content

setMaxPlayers

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function sets the maximum number of player slots on the server.

Note

This function cannot set more than as defined in mtaserver.conf . (To find out the value, use getServerConfigSetting("maxplayers"))

Syntax

setMaxPlayers ( )

Code Examples

server

This example set server slots count to half value from current value.

local curMaxPlayers = getMaxPlayers()
local newMaxPlayers = math.ceil( curMaxPlayers / 2 )
setMaxPlayers( newMaxPlayers )