Squirrel/Server/Functions/Server/GetServerName

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
Line 29: Line 29:
 
=== Notes ===
 
=== Notes ===
  
The function [wiki:MessagePlayer MessagePlayer] and call [wiki:Squirrel/OnPlayerCommand OnPlayerCommand] were used in in this example. More info about them in corresponding pages.
+
The function [[Squirrel/Functions/Misc/MessagePlayer|MessagePlayer]] and call [[Squirrel/Events/Player/OnPlayerCommand|OnPlayerCommand]] were used in in this example. More info about them in corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
The following functions are related to this one and they might be useful:
+
{{Squirrel/Functions/Server}}
 
+
[wiki:SetServerName SetServerName] Sets the name of the server
+

Revision as of 15:21, 17 October 2008

GetServerName

This returns the name of the server.

Syntax

  1. string GetServerName()

Arguments

  • None

Example

This example will return the server name when a player types '/server'.

  1.  
  2. function OnPlayerCommand( id, cmd, text )
  3. {
  4. if ( cmd == "server" )
  5. {
  6. MessagePlayer( "You are playing on: " + GetServerName(), 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