API

Integrate powerful features from the CS2-SimpleAdmin plugin into your Counter-Strike 2 servers. Enhance management and player moderation effortlessly. Dive into our documentation to get started!

Methods

GetPlayerInfo

Returns a PlayerInfo object about player

GetPlayerInfo(player);
PlayerInfo object
Parameter
Type
Required

player

CCSPlayerController

yes

GetPlayerMuteStatus

Returns the player's current penalties

GetPlayerMuteStatus(player);
Dictionary<PenaltyType, List<(DateTime EndDateTime, int Duration, bool Passed)>>
Parameter
Type
Required

player

CCSPlayerController

yes

IssuePenalty

Execute a penalty on a player

IssuePenalty(CCSPlayerController player, CCSPlayerController? admin, PenaltyType penaltyType, string reason, int duration = -1)
Paremeter
Type
Required

player

CCSPlayerController

yes

admin

CCSPlayerController?

yes

penaltyType

PenaltyType

yes

reason

string

yes

duration

int

no

GetConnectionString

Returns database connection string

GetConnectionString();
string

GetServerAddress

Returns the address of the server

GetServerAddress();
string

GetServerId

Returns the server id

GetServerId();
int?

LogCommand

Log command usage to discord/file

LogCommand(CCSPlayerController? caller, string command);
Parameter
Type
Required

player

CCSPlayerController?

yes

command

string

yes

LogCommand

Log command usage to discord/file

LogCommand(CCSPlayerController? caller, CommandInfo command);
Parameter
Type
Required

player

CCSPlayerController?

yes

command

CommandInfo

yes

Events

OnPlayerPenaltied

Performed when a penalty is executed on a player

OnPlayerPenaltied(PlayerInfo player, PlayerInfo? admin, PenaltyType penaltyType, string reason,
    int duration = -1)

OnPlayerPenaltiedAdded

Performed when a penalty is added to offline player

OnPlayerPenaltiedAdded(SteamID player, PlayerInfo? admin, PenaltyType penaltyType, string reason,
    int duration)

PlayerInfo class

Includes information about the player

public class PlayerInfo(
    int? userId,
    int slot,
    SteamID steamId,
    string name,
    string? ipAddress,
    int totalBans = 0,
    int totalMutes = 0,
    int totalGags = 0,
    int totalSilences = 0,
    int totalWarns = 0)
{
    public int? UserId { get; } = userId;
    public int Slot { get; } = slot;
    public SteamID SteamId { get; } = steamId;
    public string Name { get; } = name;
    public string? IpAddress { get; } = ipAddress;
    public int TotalBans { get; set; } = totalBans;
    public int TotalMutes { get; set; } = totalMutes;
    public int TotalGags { get; set; } = totalGags;
    public int TotalSilences { get; set; } = totalSilences;
    public int TotalWarns { get; set; } = totalWarns;
    public DiePosition? DiePosition { get; set; }
}

public class DiePosition(Vector? position = null, QAngle? angle = null)
{
    public Vector? Position { get; set; } = position;
    public QAngle? Angle { get; set; } = angle;
}

PenaltyType enum

List of penalties

public enum PenaltyType
{
    Ban = 0,
    Kick,
    Mute,
    Gag,
    Silence,
    Warn
}

Last updated