Squirrel/Server/Functions/Server/SetMaxPlayers

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
{{Squirrel/Title|SetMaxPlayers}}
 
{{Squirrel/Title|SetMaxPlayers}}
Changes the maximum players limit of the server.
+
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 you want to set
+
* '''limit''' - The number of players allowed to join
  
 
== Example ==
 
== Example ==
Line 15: Line 15:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function OnPlayerCommand( id, cmd, text )
+
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/OnPlayerCommand|OnPlayerCommand]] was also used in the example. More info about this in the corresponding page.
+
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

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function changes the maximum player limit of the server.

[edit] Syntax

  1. 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'

  1.  
  2. function onPlayerCommand( plr, cmd, text )
  3. {
  4. if ( cmd == "setlimit" )
  5. {
  6. SetMaxPlayers( text.tointeger() );
  7. }
  8. return 1;
  9. }
  10.  

[edit] Notes

The call onPlayerCommand was also used in the example. More info about it can be found in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox