GetClosestPlayer

From Liberty Unleashed Wiki
Revision as of 10:30, 11 October 2010 by VRocker (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function finds the closest player to another player.

Syntax

  1. bool GetClosestPlayer( pointer pPlayer )

Arguments

  • pPlayer - The player that you wish to find the closest player to.

Example

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "closest" )
  5. {
  6. local pClosest = GetClosestPlayer( pPlayer );
  7. MessagePlayer( "The closest player to you is " + pClosest.Name + ".", pPlayer );
  8. }
  9. }
  10.  

This will tell the player who is closest to them.

Notes

The call onPlayerCommand and Player.Name and MessagePlayer were used in in this example. More info about them in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox