Squirrel/Server/Functions/Players/Ping

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '__NOTOC__ This function returns player's Ping. == Syntax == <code>int player.Ping</code> == Example == This command tells player their ping when they type '/myping'. <code l…')
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|Player.Ping}}
This function returns player's Ping.
+
This ''Player'' class member returns the player's current ping.
  
 
== Syntax ==
 
== Syntax ==
  
<code>int player.Ping</code>
+
<code>int Player.Ping</code>
 +
 
 +
== Arguments ==
 +
 
 +
* '''none'''
  
 
== Example ==
 
== Example ==
Line 11: Line 15:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function OnPlayerCommand( pPlayer, cmd, text )
+
function onPlayerCommand( pPlayer, cmd, text )
 
{
 
{
 
     if ( cmd == "myping" )
 
     if ( cmd == "myping" )
 
     {
 
     {
           MessagePlayer( "Your ping: " + pPlayer.Ping, player );
+
           MessagePlayer( "Your ping: " + pPlayer.Ping, pPlayer );
 
     }
 
     }
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
Line 22: Line 28:
 
=== Notes ===
 
=== Notes ===
  
The functions [[Squirrel/Functions/Misc/MessagePlayer|MessagePlayer]], [[Squirrel/Functions/Misc/GetPlayerName|GetPlayerName]] 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 in this example. More info about them in corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Functions/Players}}
 
{{Squirrel/Functions/Players}}

Revision as of 23:51, 28 September 2010

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

This Player class member returns the player's current ping.

Syntax

  1. int Player.Ping

Arguments

  • none

Example

This command tells player their ping when they type '/myping'.

  1.  
  2. function onPlayerCommand( pPlayer, cmd, text )
  3. {
  4. if ( cmd == "myping" )
  5. {
  6. MessagePlayer( "Your ping: " + pPlayer.Ping, pPlayer );
  7. }
  8. return 1;
  9. }
  10.  

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/Players

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox