FindPlayer

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function finds a player from an ID or part of the nick and returns the pointer to that player. If no player is found, null will be returned.

Syntax

FindPlayer can take 2 different lists of parameters. These are:

  1. Player FindPlayer( int id )
  1. Player FindPlayer( string name )

Arguments

  • id - The ID of the player to be found
  • name - The name (or part of it) of the player to be found
  1.  
  2. function onClientCommand( cmd, text )
  3. {
  4. if ( cmd == "findplr" )
  5. {
  6. local plr;
  7.  
  8. if ( ( text ) && ( IsNum( text ) ) ) plr = FindPlayer( text.tointeger() );
  9. else plr = FindPlayer( text.tointeger() );
  10.  
  11. if ( plr ) MessagePlayer( "Found player: " + plr + "!", player );
  12. else MessagePlayer( "No player found.", player );
  13. }
  14. }
  15.  

This command will try and find the specified player.

Notes

The call onClientCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox