Squirrel/Client/Functions/Players/FindLocalPlayer

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|FindLocalPlayer}} This function returns the player instance of the player running the client script. == Syntax == <code>Player FindLocalPlayer( )</code> == Ex…')
 

Latest revision as of 03:56, 24 September 2011

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

This function returns the player instance of the player running the client script.

[edit] Syntax

  1. Player FindLocalPlayer( )

[edit] Example

  1.  
  2. function onClientCommand( cmd, text )
  3. {
  4. if ( cmd == "whatsmyname" )
  5. {
  6. local plr = FindLocalPlayer();
  7. if(plr)
  8. Message( "Your name is " + plr.Name );
  9. }
  10. }
  11.  

This command will message a player their name when they use the client command /whatsmyname.

[edit] Notes

The call onClientCommand 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