Squirrel/Server/Functions/Server/GetPort

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This returns the port the server is running on. == Syntax == <code>int GetPort()</code> == Arguments == *'''None''' == Example == This will return the server port when a pl...)
 
m (Squirrel/Functions/Server/GetPort moved to Squirrel/Server/Functions/Server/GetPort: Separating from clientside scripts)

Revision as of 04:19, 14 November 2009

This returns the port the server is running on.

Syntax

  1. int GetPort()

Arguments

  • None

Example

This will return the server port when a player types '/port'

  1.  
  2. function OnPlayerCommand( id, cmd, text )
  3. {
  4. if ( cmd == "port" )
  5. {
  6. MessagePlayer( "Server is running on port: " + GetPort(), id );
  7. }
  8. }
  9.  

Notes

The function MessagePlayer and call OnPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Template:Squirrel/Functions/Server

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox