Squirrel/Server/Functions/Players/ID

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|Player.ID}}
 
This function returns player's ID.
 
This function returns player's ID.
  

Revision as of 10:32, 11 October 2010

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

This function returns player's ID.

Syntax

  1. int player.ID

Example

This command gives player's ID when someone types '/getid playername'.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "getid" )
  5. {
  6. local pPlr;
  7. if ( szText )
  8. {
  9. pPlr = FindPlayer( szText );
  10. if ( pPlr ) MessagePlayer( pPlr.Name + "'s ID is " + pPlr.ID + " ticks.", pPlayer );
  11. else MessagePlayer( "Unknown player!", pPlayer );
  12. }
  13. else MessagePlayer( "Your ID is " + pPlayer.ID + " ticks.", pPlayer );
  14. }
  15. return 1;
  16. }
  17.  

Notes

The functions MessagePlayer and FindPlayer and Player.Name and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Template:Squirrel/Functions/Players

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox