1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-13 00:28:10 -05:00

kick clients with default name or an inuse name

fixed regular expression not being escaped when matching names
fixed reset stats
fixed duplicate kills
This commit is contained in:
RaidMax
2018-02-26 22:24:19 -06:00
parent 0496aa7f21
commit 2a6878351b
14 changed files with 190 additions and 76 deletions

View File

@ -123,6 +123,16 @@ namespace StatsPlugin.Helpers
}
playerStats.Add(pl.ClientNumber, clientStats);
}
var detectionStats = Servers[serverId].PlayerDetections;
lock (detectionStats)
{
if (detectionStats.ContainsKey(pl.ClientNumber))
detectionStats.Remove(pl.ClientNumber);
detectionStats.Add(pl.ClientNumber, new Cheat.Detection(Log));
}
return clientStats;
}
@ -135,6 +145,7 @@ namespace StatsPlugin.Helpers
{
int serverId = pl.CurrentServer.GetHashCode();
var playerStats = Servers[serverId].PlayerStats;
var detectionStats = Servers[serverId].PlayerDetections;
var serverStats = Servers[serverId].ServerStatistics;
var statsSvc = ContextThreads[serverId];
@ -143,6 +154,8 @@ namespace StatsPlugin.Helpers
// remove the client from the stats dictionary as they're leaving
lock (playerStats)
playerStats.Remove(pl.ClientNumber);
lock (detectionStats)
detectionStats.Remove(pl.ClientNumber);
// sync their stats before they leave
UpdateStats(clientStats);
@ -163,8 +176,9 @@ namespace StatsPlugin.Helpers
{
await AddStandardKill(attacker, victim);
return;
var statsSvc = ContextThreads[serverId];
var playerDetection = Servers[serverId].PlayerDetections[attacker.ClientNumber];
var kill = new EFClientKill()
{
Active = true,
@ -180,6 +194,10 @@ namespace StatsPlugin.Helpers
Weapon = ParseEnum<IW4Info.WeaponName>.Get(weapon, typeof(IW4Info.WeaponName))
};
playerDetection.ProcessKill(kill);
return;
statsSvc.KillStatsSvc.Insert(kill);
await statsSvc.KillStatsSvc.SaveChangesAsync();
}