Squirrel/Server/Functions/Server/SetMaxPlayers
From Liberty Unleashed Wiki
(Difference between revisions)
Line 1: | Line 1: | ||
{{Squirrel/Title|SetMaxPlayers}} | {{Squirrel/Title|SetMaxPlayers}} | ||
− | + | This function changes the maximum player limit of the server. | |
== Syntax == | == Syntax == | ||
Line 8: | Line 8: | ||
== Arguments == | == Arguments == | ||
− | * '''limit''' - The number of players allowed to join | + | * '''limit''' - The number of players allowed to join |
== Example == | == Example == | ||
Line 15: | Line 15: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | function onPlayerCommand( plr, cmd, text ) |
{ | { | ||
if ( cmd == "setlimit" ) | if ( cmd == "setlimit" ) | ||
Line 21: | Line 21: | ||
SetMaxPlayers( text.tointeger() ); | SetMaxPlayers( text.tointeger() ); | ||
} | } | ||
+ | |||
+ | return 1; | ||
} | } | ||
</code> | </code> | ||
Line 26: | Line 28: | ||
=== Notes === | === Notes === | ||
− | The call [[Squirrel/Events/Player/ | + | The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was also used in the example. More info about it can be found in the corresponding page. |
== Related Functions == | == Related Functions == | ||
− | {{Squirrel/Functions/Server}} | + | {{Squirrel/Server/Functions/Server}} |
Latest revision as of 23:42, 9 June 2011
This function changes the maximum player limit of the server.
[edit] Syntax
bool SetMaxPlayers( int limit )
[edit] Arguments
- limit - The number of players allowed to join
[edit] Example
This example will change the server player limit when a player types '/setlimit 20'
function onPlayerCommand( plr, cmd, text ) { if ( cmd == "setlimit" ) { SetMaxPlayers( text.tointeger() ); } return 1; }
[edit] Notes
The call onPlayerCommand was also used in the example. More info about it can be found in the corresponding page.