- Small fixes
This commit is contained in:
Dawid Bepierszcz
2024-01-25 01:00:31 +01:00
parent 855f087a7b
commit 450a7804c6
5 changed files with 74 additions and 33 deletions

View File

@@ -44,6 +44,8 @@ namespace CS2_SimpleAdmin
type = muteType,
serverid = CS2_SimpleAdmin.ServerId
});
await connection.CloseAsync();
}
public async Task AddMuteBySteamid(string playerSteamId, PlayerInfo issuer, string reason, int time = 0, int type = 0)
@@ -75,6 +77,8 @@ namespace CS2_SimpleAdmin
type = muteType,
serverid = CS2_SimpleAdmin.ServerId
});
await connection.CloseAsync();
}
public async Task<List<dynamic>> IsPlayerMuted(string steamId)
@@ -87,6 +91,8 @@ namespace CS2_SimpleAdmin
string sql = "SELECT * FROM sa_mutes WHERE player_steamid = @PlayerSteamID AND status = 'ACTIVE' AND (duration = 0 OR ends > @CurrentTime)";
var activeMutes = (await connection.QueryAsync(sql, new { PlayerSteamID = steamId, CurrentTime = now })).ToList();
await connection.CloseAsync();
return activeMutes;
}
@@ -100,6 +106,8 @@ namespace CS2_SimpleAdmin
muteCount = await connection.ExecuteScalarAsync<int>(sql, new { PlayerSteamID = steamId });
await connection.CloseAsync();
return muteCount;
}
@@ -134,6 +142,8 @@ namespace CS2_SimpleAdmin
string sqlUnban = "UPDATE sa_mutes SET status = 'UNMUTED' WHERE (player_steamid = @pattern OR player_name = @pattern) AND type = @muteType AND status = 'ACTIVE'";
await connection.ExecuteAsync(sqlUnban, new { pattern = playerPattern, muteType });
await connection.CloseAsync();
}
public async Task ExpireOldMutes()
@@ -143,6 +153,8 @@ namespace CS2_SimpleAdmin
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 });
await connection.CloseAsync();
}
public async Task CheckMute(PlayerInfo player)