Squirrel/Server/Functions/Players/FindPlayer

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Arguments)
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|FindPlayer}}
 
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.
 
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.
  

Latest revision as of 10:30, 11 October 2010

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.

[edit] Syntax

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

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

[edit] 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 onPlayerCommand( player, 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.

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox