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

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 );
	}
}

Section: Finding and counting entities

Categories: Server functions | Finding and counting entities