A CounterStrike Sharp plugin that tracks player data in a MySQL database and automatically executes cleanup rules based on configurable time periods.
- Player Tracking: Automatically tracks player connections and disconnections
- Database Storage: Stores player data including SteamID, name, first login, last login, and last logout
- Configurable Cleanup Rules: Execute custom SQL queries based on time-based conditions
- Automatic Execution: Cleanup rules are executed on round start (configurable)
The plugin creates a player_data table with the following structure:
CREATE TABLE player_data (
steamid BIGINT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
first_login DATETIME NOT NULL,
last_login DATETIME NOT NULL,
last_logout DATETIME NULL,
INDEX idx_last_login (last_login),
INDEX idx_first_login (first_login)
);The plugin uses a config.json file with the following structure:
{
"Database": {
"Host": "your_database_host",
"Port": 3306,
"Username": "your_username",
"Password": "your_password",
"DatabaseName": "your_database_name"
},
"Rules": [
{
"Rule": "@lastLogin>30d",
"Queries": [
"DELETE FROM wp_player_skins WHERE steamid = @steamid;",
"DELETE FROM wp_player_stats WHERE steamid = @steamid;"
]
},
{
"Rule": "@firstLogin>60d",
"Queries": [
"DELETE FROM players WHERE steamid = @steamid;"
]
}
]
}Rules follow the format: @field>Xd where:
@fieldcan be:@lastLogin- Last login time@firstLogin- First login time@lastLogout- Last logout time
Xis the number of daysdindicates days (currently the only supported unit)
In your SQL queries, you can use:
@steamid- Will be replaced with the player's SteamID
- Build the plugin using .NET 8.0
- Copy the compiled DLL to your CounterStrike Sharp plugins folder
- Configure the
config.jsonfile with your database credentials - Restart your server
- CounterStrike Sharp
- MySQL Database
- .NET 9.0 Runtime