Forgotten column with the reason for the ban

OOOooops :D
This commit is contained in:
daffyyyy
2023-12-03 01:22:18 +01:00
parent 35e6a52ad8
commit d496977c76
2 changed files with 6 additions and 3 deletions

View File

@@ -23,14 +23,15 @@ namespace CS2_SimpleAdmin
DateTime now = DateTime.Now;
DateTime futureTime = now.AddMinutes(time);
var sql = "INSERT INTO `sa_bans` (`player_steamid`, `player_name`, `admin_steamid`, `admin_name`, `duration`, `ends`, `created`) " +
"VALUES (@playerSteamid, @playerName, @adminSteamid, @adminName, @duration, @ends, @created)";
var sql = "INSERT INTO `sa_bans` (`player_steamid`, `player_name`, `admin_steamid`, `admin_name`, `reason`, `duration`, `ends`, `created`) " +
"VALUES (@playerSteamid, @playerName, @adminSteamid, @adminName, @banReason, @duration, @ends, @created)";
_dbConnection.Execute(sql, new
{
playerSteamid = player.AuthorizedSteamID.SteamId64.ToString(),
playerName = player.PlayerName,
adminSteamid = issuer == null ? "Console" : issuer?.AuthorizedSteamID?.SteamId64.ToString(),
adminName = issuer == null ? "Console" : issuer.PlayerName,
banReason = reason,
duration = time,
ends = futureTime,
created = now
@@ -58,7 +59,8 @@ namespace CS2_SimpleAdmin
_dbConnection.Open();
string sql = "UPDATE sa_bans SET status = 'EXPIRED' WHERE status = 'ACTIVE' AND `duration` > 0 AND ends <= @CurrentTime";
int affectedRows = _dbConnection.Execute(sql, new { CurrentTime = DateTime.Now });
_dbConnection.Execute(sql, new { CurrentTime = DateTime.Now });
//int affectedRows = _dbConnection.Execute(sql, new { CurrentTime = DateTime.Now });
_dbConnection.Close();
}

View File

@@ -61,6 +61,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
`player_name` VARCHAR(128) NOT NULL,
`admin_steamid` VARCHAR(64) NOT NULL,
`admin_name` VARCHAR(128) NOT NULL,
`reason` VARCHAR(255) NOT NULL,
`duration` INT NOT NULL,
`ends` TIMESTAMP NOT NULL,
`created` TIMESTAMP NOT NULL,