Player.ID

From Liberty Unleashed Wiki
Jump to: navigation, search
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

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox