mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-10-18 12:57:04 +02:00
Added info about crashes with bots
This commit is contained in:
parent
3793385ce4
commit
aa95815fbd
6 changed files with 89 additions and 56 deletions
|
|
@ -17,7 +17,7 @@ namespace CS2_SimpleAdmin
|
|||
{
|
||||
if (player == null || player.SteamId == null) return;
|
||||
|
||||
using var connection = await _database.GetConnection();
|
||||
await using var connection = await _database.GetConnectionAsync();
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime futureTime = now.AddMinutes(time);
|
||||
|
|
@ -48,7 +48,7 @@ namespace CS2_SimpleAdmin
|
|||
{
|
||||
if (string.IsNullOrEmpty(playerSteamId)) return;
|
||||
|
||||
using var connection = await _database.GetConnection();
|
||||
await using var connection = await _database.GetConnectionAsync();
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime futureTime = now.AddMinutes(time);
|
||||
|
|
@ -81,9 +81,14 @@ namespace CS2_SimpleAdmin
|
|||
return new List<dynamic>();
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if (CS2_SimpleAdmin._logger != null)
|
||||
CS2_SimpleAdmin._logger.LogCritical($"IsPlayerMuted for {steamId}");
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
using var connection = await _database.GetConnection();
|
||||
await using var connection = await _database.GetConnectionAsync();
|
||||
DateTime currentTimeUtc = DateTime.UtcNow;
|
||||
string sql = "SELECT * FROM sa_mutes WHERE player_steamid = @PlayerSteamID AND status = 'ACTIVE' AND (duration = 0 OR ends > @CurrentTime)";
|
||||
|
||||
|
|
@ -99,7 +104,7 @@ namespace CS2_SimpleAdmin
|
|||
|
||||
public async Task<int> GetPlayerMutes(string steamId)
|
||||
{
|
||||
using var connection = await _database.GetConnection();
|
||||
await using var connection = await _database.GetConnectionAsync();
|
||||
|
||||
int muteCount;
|
||||
string sql = "SELECT COUNT(*) FROM sa_mutes WHERE player_steamid = @PlayerSteamID";
|
||||
|
|
@ -116,7 +121,7 @@ namespace CS2_SimpleAdmin
|
|||
return;
|
||||
}
|
||||
|
||||
using var connection = await _database.GetConnection();
|
||||
await using var connection = await _database.GetConnectionAsync();
|
||||
|
||||
if (type == 2)
|
||||
{
|
||||
|
|
@ -140,7 +145,7 @@ namespace CS2_SimpleAdmin
|
|||
{
|
||||
try
|
||||
{
|
||||
using var connection = await _database.GetConnection();
|
||||
await using var connection = await _database.GetConnectionAsync();
|
||||
|
||||
string sql = "UPDATE sa_mutes SET status = 'EXPIRED' WHERE status = 'ACTIVE' AND `duration` > 0 AND ends <= @CurrentTime";
|
||||
await connection.ExecuteAsync(sql, new { CurrentTime = DateTime.Now });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue