Table of Contents

Class AdminManager

Namespace
CounterStrikeSharp.API.Modules.Admin
Assembly
CounterStrikeSharp.API.dll
public static class AdminManager
Inheritance
AdminManager

Properties

CommandManagerProvider

public static ICommandManager CommandManagerProvider { get; }

Property Value

ICommandManager

Methods

AddCommands()

public static void AddCommands()

AddPermissionOverride(string, params string[])

Adds a new permission to a command override. This is not saved to "configs/admin_overrides.json".

public static void AddPermissionOverride(string commandName, params string[] permissions)

Parameters

commandName string

Name of the command.

permissions string[]

Permissions to add to the command override.

AddPlayerPermissions(CCSPlayerController?, params string[])

Temporarily adds a permission flag to the player. These flags are not saved to "configs/admins.json".

public static void AddPlayerPermissions(CCSPlayerController? player, params string[] flags)

Parameters

player CCSPlayerController

Player controller to add a flag to.

flags string[]

Flags to add for the player.

AddPlayerPermissions(SteamID?, params string[])

Temporarily adds a permission flag to the player. These flags are not saved to "configs/admins.json".

public static void AddPlayerPermissions(SteamID? steamId, params string[] flags)

Parameters

steamId SteamID

SteamID to add a flag to.

flags string[]

Flags to add for the player.

AddPlayerToGroup(CCSPlayerController?, params string[])

Adds a player to a group. This does NOT modify the immunity of the player (see SetPlayerImmunity).

public static void AddPlayerToGroup(CCSPlayerController? player, params string[] groups)

Parameters

player CCSPlayerController

Player controller.

groups string[]

Groups to add the player to.

AddPlayerToGroup(SteamID?, params string[])

Adds a player to a group. This does NOT modify the immunity of the player (see SetPlayerImmunity).

public static void AddPlayerToGroup(SteamID? steamId, params string[] groups)

Parameters

steamId SteamID

SteamID of the player.

groups string[]

Groups to add the player to.

CanPlayerTarget(CCSPlayerController?, CCSPlayerController?)

Checks to see if a player can target another player based on their immunity value.

public static bool CanPlayerTarget(CCSPlayerController? caller, CCSPlayerController? target)

Parameters

caller CCSPlayerController

Caller of the command.

target CCSPlayerController

Target of the command.

Returns

bool

CanPlayerTarget(SteamID?, SteamID?)

Checks to see if a player can target another player based on their immunity value.

public static bool CanPlayerTarget(SteamID? caller, SteamID? target)

Parameters

caller SteamID

Caller of the command.

target SteamID

Target of the command.

Returns

bool

ClearPermissionOverride(string, bool)

Clears all permissions from a command override. This is not saved to "configs/admin_overrides.json".

public static void ClearPermissionOverride(string commandName, bool disable = true)

Parameters

commandName string

Name of the command.

disable bool

Whether to disable the command override after clearing.

ClearPlayerPermissions(CCSPlayerController?)

Temporarily removes all permission flags from a player. These flags are not saved to "configs/admins.json".

public static void ClearPlayerPermissions(CCSPlayerController? player)

Parameters

player CCSPlayerController

Player controller to remove flags from.

ClearPlayerPermissions(SteamID?)

Temporarily removes all permission flags from a player. These flags are not saved to "configs/admins.json".

public static void ClearPlayerPermissions(SteamID? steamId)

Parameters

steamId SteamID

Steam ID to remove flags from.

CommandIsOverriden(string)

Checks to see if a command has overriden permissions.

public static bool CommandIsOverriden(string commandName)

Parameters

commandName string

Name of the command.

Returns

bool

True if the command has overriden permissions, false if not.

DeleteCommandOverride(string)

Deletes a command override. This is not saved to "configs/admin_overrides.json".

public static void DeleteCommandOverride(string commandName)

Parameters

commandName string

Name of the command.

GetCommandOverrideData(string)

Grabs the data for a command override that was loaded from "configs/admin_overrides.json".

public static CommandData? GetCommandOverrideData(string commandName)

Parameters

commandName string

Name of the command.

Returns

CommandData

CommandData class if found, null if not.

GetPermissionOverrides(string)

Grabs the new, overriden flags for a command.

public static string[] GetPermissionOverrides(string commandName)

Parameters

commandName string

Name of the command.

Returns

string[]

If the command is valid, a valid array of flags.

GetPlayerAdminData(CCSPlayerController?)

Grabs the admin data for a player that was loaded from "configs/admins.json" and "configs/admins_groups.json".

public static AdminData? GetPlayerAdminData(CCSPlayerController? player)

Parameters

player CCSPlayerController

Player controller

Returns

AdminData

AdminData class if data found, null if not.

GetPlayerAdminData(SteamID?)

Grabs the admin data for a player that was loaded from "configs/admins.json" and "configs/admins_groups.json".

public static AdminData? GetPlayerAdminData(SteamID? steamId)

Parameters

steamId SteamID

SteamID object of the player.

Returns

AdminData

AdminData class if data found, null if not.

GetPlayerCommandOverrideState(CCSPlayerController?, string)

Gets the value of a command override state.

public static bool GetPlayerCommandOverrideState(CCSPlayerController? player, string command)

Parameters

player CCSPlayerController

Player or server console.

command string

Name of the command to check for.

Returns

bool

True if override is active, false if not.

GetPlayerCommandOverrideState(SteamID?, string)

Gets the value of a command override state.

public static bool GetPlayerCommandOverrideState(SteamID? steamId, string command)

Parameters

steamId SteamID

Steam ID object.

command string

Name of the command to check for.

Returns

bool

True if override is active, false if not.

GetPlayerImmunity(CCSPlayerController?)

Returns the immunity value for a player.

public static uint GetPlayerImmunity(CCSPlayerController? player)

Parameters

player CCSPlayerController

Player controller.

Returns

uint

If an immunity value is present in "configs/admins_groups.json" and in "configs/admins.json", the returned value will be the greater of the two. If the value is overriden with SetPlayerImmunity, that value is returned instead.

GetPlayerImmunity(SteamID?)

Returns the immunity value for a player.

public static uint GetPlayerImmunity(SteamID? steamId)

Parameters

steamId SteamID

Steam ID of the player.

Returns

uint

If an immunity value is present in "configs/admins_groups.json" and in "configs/admins.json", the returned value will be the greater of the two. If the value is overriden with SetPlayerImmunity, that value is returned instead.

LoadAdminData(string)

public static void LoadAdminData(string adminDataPath)

Parameters

adminDataPath string

LoadAdminGroups(string)

public static void LoadAdminGroups(string adminGroupsPath)

Parameters

adminGroupsPath string

LoadCommandOverrides(string)

public static void LoadCommandOverrides(string overridePath)

Parameters

overridePath string

MergeGroupPermsIntoAdmins()

public static void MergeGroupPermsIntoAdmins()

PlayerHasCommandOverride(CCSPlayerController?, string)

Checks to see if a player has a command override. This does NOT return the actual state of the override.

public static bool PlayerHasCommandOverride(CCSPlayerController? player, string command)

Parameters

player CCSPlayerController

Player or server console.

command string

Name of the command to check for.

Returns

bool

True if override exists, false if not.

PlayerHasCommandOverride(SteamID?, string)

Checks to see if a player has a command override. This does NOT return the actual state of the override.

public static bool PlayerHasCommandOverride(SteamID? steamId, string command)

Parameters

steamId SteamID

Steam ID object.

command string

Name of the command to check for.

Returns

bool

True if override exists, false if not.

PlayerHasPermissions(CCSPlayerController?, params string[])

Checks to see if a player has access to a certain set of permission flags.

public static bool PlayerHasPermissions(CCSPlayerController? player, params string[] flags)

Parameters

player CCSPlayerController

Player or server console.

flags string[]

Flags to look for in the players permission flags.

Returns

bool

True if flags are present, false if not.

PlayerHasPermissions(SteamID?, params string[])

Checks to see if a player has access to a certain set of permission flags.

public static bool PlayerHasPermissions(SteamID? steamId, params string[] flags)

Parameters

steamId SteamID

Steam ID object.

flags string[]

Flags to look for in the players permission flags.

Returns

bool

True if flags are present, false if not.

PlayerInGroup(CCSPlayerController?, params string[])

Checks to see if the player is part of an admin group.

public static bool PlayerInGroup(CCSPlayerController? player, params string[] groups)

Parameters

player CCSPlayerController

Player controller.

groups string[]

Groups to check for.

Returns

bool

True if a player is part of all of the groups provided, false if not.

PlayerInGroup(SteamID?, params string[])

Checks to see if the player is part of an admin group.

public static bool PlayerInGroup(SteamID? steamId, params string[] groups)

Parameters

steamId SteamID

SteamID of the player.

groups string[]

Groups to check for.

Returns

bool

True if a player is part of all of the groups provided, false if not.

RemovePermissionOverride(string, params string[])

Removes a permission from a command override. This is not saved to "configs/admin_overrides.json".

public static void RemovePermissionOverride(string commandName, params string[] permissions)

Parameters

commandName string

Name of the command.

permissions string[]

Permissions to remove from the command override.

RemovePlayerAdminData(CCSPlayerController?)

Removes a players admin data. This is not saved to "configs/admins.json"

public static void RemovePlayerAdminData(CCSPlayerController? player)

Parameters

player CCSPlayerController

Player controller

RemovePlayerAdminData(SteamID?)

Removes a players admin data. This is not saved to "configs/admins.json"

public static void RemovePlayerAdminData(SteamID? steamId)

Parameters

steamId SteamID

Steam ID remove admin data from.

RemovePlayerFromGroup(CCSPlayerController?, bool, params string[])

Removes a player from a group.

public static void RemovePlayerFromGroup(CCSPlayerController? player, bool removeInheritedFlags = true, params string[] groups)

Parameters

player CCSPlayerController

Player controller.

removeInheritedFlags bool

If true, all of the flags that the player inherited from being in the group will be removed.

groups string[]

RemovePlayerFromGroup(SteamID?, bool, params string[])

Removes a player from a group.

public static void RemovePlayerFromGroup(SteamID? steamId, bool removeInheritedFlags = true, params string[] groups)

Parameters

steamId SteamID

SteamID of the player.

removeInheritedFlags bool

If true, all of the flags that the player inherited from being in the group will be removed.

groups string[]

RemovePlayerPermissions(CCSPlayerController?, params string[])

Temporarily removes a permission flag to the player. These flags are not saved to "configs/admins.json".

public static void RemovePlayerPermissions(CCSPlayerController? player, params string[] flags)

Parameters

player CCSPlayerController

Player controller to remove flags from.

flags string[]

Flags to remove from the player.

RemovePlayerPermissions(SteamID?, params string[])

Temporarily removes a permission flag to the player. These flags are not saved to "configs/admins.json".

public static void RemovePlayerPermissions(SteamID? steamId, params string[] flags)

Parameters

steamId SteamID

Steam ID to remove flags from.

flags string[]

Flags to remove from the player.

SetCommandOverideState(string, bool)

Sets a command override to be enabled or disabled. This is not saved to "configs/admin_overrides.json".

public static void SetCommandOverideState(string commandName, bool state)

Parameters

commandName string

Name of the command.

state bool

New state of the command override.

SetPlayerCommandOverride(CCSPlayerController?, string, bool)

Sets a player command override. This is not saved to "configs/admins.json".

public static void SetPlayerCommandOverride(CCSPlayerController? player, string command, bool state)

Parameters

player CCSPlayerController

Player or server console.

command string

Name of the command to check for.

state bool

New state of the command override.

SetPlayerCommandOverride(SteamID?, string, bool)

Sets a player command override. This is not saved to "configs/admins.json".

public static void SetPlayerCommandOverride(SteamID? steamId, string command, bool state)

Parameters

steamId SteamID

SteamID to add a flag to.

command string

Name of the command to check for.

state bool

New state of the command override.

SetPlayerImmunity(CCSPlayerController?, uint)

Sets the immunity value for a player.

public static void SetPlayerImmunity(CCSPlayerController? player, uint value)

Parameters

player CCSPlayerController

Player controller.

value uint

New immunity value.

SetPlayerImmunity(SteamID?, uint)

Sets the immunity value for a player.

public static void SetPlayerImmunity(SteamID? steamId, uint value)

Parameters

steamId SteamID

Steam ID of the player.

value uint

New immunity value.