Squirrel/Server/Functions/Server/GetServerName

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
{{Squirrel/Title|GetServerName}}
 
{{Squirrel/Title|GetServerName}}
= GetServerName =
 
 
 
This returns the name of the server.
 
This returns the name of the server.
  
Line 17: Line 15:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function OnPlayerCommand( id, cmd, text )
+
function onPlayerCommand( plr, cmd, text )
 
{
 
{
 
     if ( cmd == "server" )
 
     if ( cmd == "server" )
 
     {
 
     {
           MessagePlayer( "You are playing on: " + GetServerName(), id );
+
           MessagePlayer( "You are playing on: " + GetServerName(), plr );
 
     }
 
     }
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
Line 28: Line 28:
 
=== Notes ===
 
=== Notes ===
  
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.
+
The function [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] were used in this example. More info about them can be found in corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
{{Squirrel/Functions/Server}}
+
{{Squirrel/Server/Functions/Server}}

Latest revision as of 23:25, 9 June 2011

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

This returns the name of the server.

[edit] Syntax

  1. string GetServerName()

[edit] Arguments

  • None

[edit] Example

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

  1.  
  2. function onPlayerCommand( plr, cmd, text )
  3. {
  4. if ( cmd == "server" )
  5. {
  6. MessagePlayer( "You are playing on: " + GetServerName(), plr );
  7. }
  8. return 1;
  9. }
  10.  

[edit] Notes

The function MessagePlayer and call onPlayerCommand were used in this example. More info about them can be found in corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox