Squirrel/Server/Functions/Players/GetClosestPlayer
From Liberty Unleashed Wiki
This function finds the closest player to another player.
Syntax
bool GetClosestPlayer( pointer pPlayer )
Arguments
- pPlayer - The player that you wish to find the closest player to.
Example
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "closest" ) { local pClosest = GetClosestPlayer( pPlayer ); MessagePlayer( "The closest player to you is " + pClosest.Name + ".", pPlayer ); } }
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
- FindPlayer
- GetClosestPlayer
- Player.Alpha
- Player.Angle
- Player.Armour
- Player.Cash
- Player.Class
- Player.ClearWeapons
- Player.Colour
- Player.ColouredName
- Player.EnterVehicle
- Player.ExitVehicle
- Player.ForceToSpawnScreen
- Player.Frozen
- Player.GetBoundariesLower
- Player.GetBoundariesUpper
- Player.GetIgnored
- Player.Health
- Player.ID
- Player.IP
- Player.Immune
- Player.Island
- Player.LUID
- Player.Marker
- Player.MarkerScale
- Player.MarkerSprite
- Player.Muted
- Player.Name
- Player.Nametag
- Player.NametagColour
- Player.Ping
- Player.Pos
- Player.RemoveFromVehicle
- Player.RemoveLimb
- Player.Score
- Player.SetAnim
- Player.SetBoundaries
- Player.SetIgnored
- Player.SetIgnoredBy
- Player.SetVehicleEnterDoor
- Player.SetWeapon
- Player.Skin
- Player.Spawn
- Player.Spawned
- Player.Team
- Player.Train
- Player.Vehicle
- Player.VehicleSeat
- Player.Velocity
- Player.VirtualWorld
- Player.WantedLevel
- Player.Weapon
- Player.SetWeapon
- Player.WeaponAmmo
- Player.WeaponState