FindLocalPlayer

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

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

Syntax

  1. Player FindLocalPlayer( )

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.

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