Squirrel/Server/Functions/Game/SetIslands

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
{{Squirrel/Title|SetIslands}}
 
{{Squirrel/Title|SetIslands}}
 
This function sets the allowed islands when the server is in Liberty Unleashed mode. Possible values are:
 
This function sets the allowed islands when the server is in Liberty Unleashed mode. Possible values are:
* '''0''' - All islands closed
+
* '''0''' - All islands open.
* '''1''' - Portland Island open, Staunton Island and Shoreside Vale closed
+
* '''1''' - Portland and Staunton open, Shoreside closed.
* '''2''' - Portland Island and Shoreside Vale closed, Staunton Island open
+
* '''2''' - Portland closed, Staunton and Shoreside open.
* '''3''' - Portland Island and Staunton Island closed, Shoreside Vale open
+
* '''3''' - PPortland open, Staunton and Shoreside open.
* '''4''' - Portland Island and Staunton Island open, Shoreside Vale closed
+
* '''5''' - Portland Island closed, Staunton Island and Shoreside Vale open
+
* '''6''' - All islands open
+
  
 
== Syntax ==
 
== Syntax ==
Line 18: Line 15:
  
 
== Example ==
 
== Example ==
 +
 +
This will change the open islands when someone types '/setislands <value>'.
  
 
<code lang="squirrel">
 
<code lang="squirrel">
Line 24: Line 23:
 
if ( command == "setislands" )  
 
if ( command == "setislands" )  
 
{
 
{
if ( ( text.tointeger() < 7 )  && ( text.tointeger() >= 0 ) SetIslands( text.tointeger() )
+
if ( ( text.tointeger() < 4 )  && ( text.tointeger() >= 0 ) SetIslands( text.tointeger() )
else MessagePlayer( "Error - Allowed islands must be between 0 and 6", player );
+
else MessagePlayer( "Error - Allowed islands must be between 0 and 3", player );
 
}
 
}
+
 
 +
return 1;
 
}
 
}
  
Line 34: Line 34:
 
=== Notes ===
 
=== Notes ===
  
This command is used to set the available islands those who join or are currently in the server.
+
The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them in the corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Game}}
 
{{Squirrel/Server/Functions/Game}}

Revision as of 19:23, 25 October 2010

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

This function sets the allowed islands when the server is in Liberty Unleashed mode. Possible values are:

  • 0 - All islands open.
  • 1 - Portland and Staunton open, Shoreside closed.
  • 2 - Portland closed, Staunton and Shoreside open.
  • 3 - PPortland open, Staunton and Shoreside open.

Syntax

  1. bool SetIslands( int iIslands )

Arguments

  • iIslands - The value for possible islands (check above)

Example

This will change the open islands when someone types '/setislands <value>'.

  1.  
  2. function onPlayerCommand( player, command, text )
  3. {
  4. if ( command == "setislands" )
  5. {
  6. if ( ( text.tointeger() < 4 ) && ( text.tointeger() >= 0 ) SetIslands( text.tointeger() )
  7. else MessagePlayer( "Error - Allowed islands must be between 0 and 3", player );
  8. }
  9.  
  10. return 1;
  11. }
  12.  
  13.  

Notes

The function MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox