Scripting/Server/Functions/FindPlayer
Returns the Player with that integer id, or the player whose name equals the string (exact, case-sensitive). Returns null if nobody matches.
Syntax
FindPlayer(idOrName)Arguments
- any idOrName
Example
function onPlayerCommand( player, cmd, params )
{
if ( cmd == "pos" )
{
local target = FindPlayer( params.tointeger() ); // by id
if ( target ) MessagePlayer( target.Name + " is at " + target.Pos.x + ", " + target.Pos.y, player );
else MessagePlayer( "No such player.", player );
}
}Related pages
- FindVehicle
- FindObject
- FindPickup
- FindSphere
- FindBlip
- FindNPC
- GetPlayers
- GetMaxPlayers
- GetClosestPlayer
- GetVehicleCount
- GetObjectCount
- KickPlayer
Section: Finding and counting entities
Categories: Server functions | Finding and counting entities