Table of Contents

Class Target

Namespace
CounterStrikeSharp.API.Modules.Commands.Targeting
Assembly
CounterStrikeSharp.API.dll
public class Target
Inheritance
object
Target

Constructors

Target(string)

public Target(string target)

Parameters

target string

Fields

TargetTypeMap

public static readonly IReadOnlyDictionary<string, TargetType> TargetTypeMap

Field Value

IReadOnlyDictionary<string, TargetType>

Methods

FindTarget(CCSPlayerController, string, bool, bool)

Wraps ProcessTargetString() and handles producing error messages for bad targets.

public static CCSPlayerController? FindTarget(CCSPlayerController player, string targetString, bool nobots = false, bool immunity = true)

Parameters

player CCSPlayerController

The player who executed the command.

targetString string

The target string (e.g., player name, #userid, @all).

nobots bool

Optional. Set to true if bots should NOT be targetted

immunity bool

Optional. Set to false to ignore target immunity.

Returns

CCSPlayerController

GetTarget(CCSPlayerController?)

public TargetResult GetTarget(CCSPlayerController? caller)

Parameters

caller CCSPlayerController

Returns

TargetResult

ProcessTargetString(CCSPlayerController?, string, ProcessTargetFilterFlag, bool, out string, out List<CCSPlayerController>)

Processes a target string, finds matching players, and applies specified filters.

public static ProcessTargetResultFlag ProcessTargetString(CCSPlayerController? player, string targetString, ProcessTargetFilterFlag filter, bool tnIsMl, out string targetname, out List<CCSPlayerController> players)

Parameters

player CCSPlayerController

The player who executed the command.

targetString string

The target string (e.g., player name, #userid, @all).

filter ProcessTargetFilterFlag

Flags to filter the found targets.

tnIsMl bool

If true, the target name buffer will be an ML phrase. Otherwise, it will be normal string.

targetname string

An output list that will contain the resolved target names. These may be localization keys (e.g., "all", "ct") if tnIsMl is true, or actual player names otherwise.

players List<CCSPlayerController>

An output list that will be populated with the player entities matching the target string.

Returns

ProcessTargetResultFlag

ReplyToTargetError(CCSPlayerController, ProcessTargetResultFlag)

Replies to a client with a given message describing a targetting failure reason.

public static void ReplyToTargetError(CCSPlayerController player, ProcessTargetResultFlag resultFlag)

Parameters

player CCSPlayerController

The player who executed the command.

resultFlag ProcessTargetResultFlag

The ProcessTargetResultFlag value indicating why it is failed.