Squirrel/Server/Functions/Players/Ping
From Liberty Unleashed Wiki
(Difference between revisions)
(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: | ||
− | + | {{Squirrel/Title|Player.Ping}} | |
− | This | + | This ''Player'' class member returns the player's current ping. |
== Syntax == | == Syntax == | ||
− | <code>int | + | <code>int Player.Ping</code> |
+ | |||
+ | == Arguments == | ||
+ | |||
+ | * '''none''' | ||
== Example == | == Example == | ||
Line 11: | Line 15: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function | + | function onPlayerCommand( pPlayer, cmd, text ) |
{ | { | ||
if ( cmd == "myping" ) | if ( cmd == "myping" ) | ||
{ | { | ||
− | MessagePlayer( "Your ping: " + pPlayer.Ping, | + | MessagePlayer( "Your ping: " + pPlayer.Ping, pPlayer ); |
} | } | ||
+ | |||
+ | return 1; | ||
} | } | ||
</code> | </code> | ||
Line 22: | Line 28: | ||
=== Notes === | === Notes === | ||
− | The | + | 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
This Player class member returns the player's current ping.
Syntax
int Player.Ping
Arguments
- none
Example
This command tells player their ping when they type '/myping'.
function onPlayerCommand( pPlayer, cmd, text ) { if ( cmd == "myping" ) { MessagePlayer( "Your ping: " + pPlayer.Ping, pPlayer ); } return 1; }
Notes
The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.