Class AdminManager
- Namespace
- CounterStrikeSharp.API.Modules.Admin
- Assembly
- CounterStrikeSharp.API.dll
public static class AdminManager
- Inheritance
-
objectAdminManager
Properties
CommandManagerProvider
public static ICommandManager CommandManagerProvider { get; }
Property Value
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
commandNamestringName of the command.
permissionsstring[]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
playerCCSPlayerControllerPlayer controller to add a flag to.
flagsstring[]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
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
playerCCSPlayerControllerPlayer controller.
groupsstring[]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
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
callerCCSPlayerControllerCaller of the command.
targetCCSPlayerControllerTarget of the command.
Returns
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
Returns
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
commandNamestringName of the command.
disableboolWhether 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
playerCCSPlayerControllerPlayer 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
steamIdSteamIDSteam ID to remove flags from.
CommandIsOverriden(string)
Checks to see if a command has overriden permissions.
public static bool CommandIsOverriden(string commandName)
Parameters
commandNamestringName 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
commandNamestringName 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
commandNamestringName 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
commandNamestringName 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
playerCCSPlayerControllerPlayer 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
steamIdSteamIDSteamID 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
playerCCSPlayerControllerPlayer or server console.
commandstringName 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
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
playerCCSPlayerControllerPlayer 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
steamIdSteamIDSteam 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
adminDataPathstring
LoadAdminGroups(string)
public static void LoadAdminGroups(string adminGroupsPath)
Parameters
adminGroupsPathstring
LoadCommandOverrides(string)
public static void LoadCommandOverrides(string overridePath)
Parameters
overridePathstring
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
playerCCSPlayerControllerPlayer or server console.
commandstringName 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
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
playerCCSPlayerControllerPlayer or server console.
flagsstring[]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
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
playerCCSPlayerControllerPlayer controller.
groupsstring[]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
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
commandNamestringName of the command.
permissionsstring[]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
playerCCSPlayerControllerPlayer controller
RemovePlayerAdminData(SteamID?)
Removes a players admin data. This is not saved to "configs/admins.json"
public static void RemovePlayerAdminData(SteamID? steamId)
Parameters
steamIdSteamIDSteam 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
playerCCSPlayerControllerPlayer controller.
removeInheritedFlagsboolIf true, all of the flags that the player inherited from being in the group will be removed.
groupsstring[]
RemovePlayerFromGroup(SteamID?, bool, params string[])
Removes a player from a group.
public static void RemovePlayerFromGroup(SteamID? steamId, bool removeInheritedFlags = true, params string[] groups)
Parameters
steamIdSteamIDSteamID of the player.
removeInheritedFlagsboolIf true, all of the flags that the player inherited from being in the group will be removed.
groupsstring[]
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
playerCCSPlayerControllerPlayer controller to remove flags from.
flagsstring[]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
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
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
playerCCSPlayerControllerPlayer or server console.
commandstringName of the command to check for.
stateboolNew 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
steamIdSteamIDSteamID to add a flag to.
commandstringName of the command to check for.
stateboolNew state of the command override.
SetPlayerImmunity(CCSPlayerController?, uint)
Sets the immunity value for a player.
public static void SetPlayerImmunity(CCSPlayerController? player, uint value)
Parameters
playerCCSPlayerControllerPlayer controller.
valueuintNew immunity value.
SetPlayerImmunity(SteamID?, uint)
Sets the immunity value for a player.
public static void SetPlayerImmunity(SteamID? steamId, uint value)