mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-18 02:41:55 +00:00
1.7.2a
- Temp fix for player.Disconnect - Fix for no reasons - Fix for no time used - Added check for hibernation - Some changes in unwarn action
This commit is contained in:
@@ -156,12 +156,16 @@ internal static class Helper
|
||||
if (!player.IsValid || player.IsHLTV)
|
||||
return;
|
||||
|
||||
player.Disconnect(reason);
|
||||
Server.ExecuteCommand($"kickid {player.UserId}");
|
||||
|
||||
// player.Disconnect(reason); Broken after last update
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
player.Disconnect(reason);
|
||||
Server.ExecuteCommand($"kickid {player.UserId}");
|
||||
|
||||
player.Disconnect(reason); // Broken after last update
|
||||
}
|
||||
|
||||
if (CS2_SimpleAdmin.UnlockedCommands && reason == NetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_BANNED)
|
||||
@@ -196,13 +200,26 @@ internal static class Helper
|
||||
{
|
||||
if (!player.IsValid || player.IsHLTV)
|
||||
return;
|
||||
|
||||
player.Disconnect(reason);
|
||||
|
||||
// if (!string.IsNullOrEmpty(reason))
|
||||
// {
|
||||
// var escapeChars = reason.IndexOfAny([';', '|']);
|
||||
//
|
||||
// if (escapeChars != -1)
|
||||
// {
|
||||
// reason = reason[..escapeChars];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
Server.ExecuteCommand($"kickid {player.UserId}");
|
||||
// player.Disconnect(reason); // Broken after last update
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
player.Disconnect(reason);
|
||||
Server.ExecuteCommand($"kickid {player.UserId}");
|
||||
|
||||
// player.Disconnect(reason); // Broken after last update
|
||||
}
|
||||
|
||||
if (CS2_SimpleAdmin.UnlockedCommands && reason == NetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_BANNED)
|
||||
@@ -223,12 +240,15 @@ internal static class Helper
|
||||
|
||||
public static int ParsePenaltyTime(string time)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(time))
|
||||
if (string.IsNullOrWhiteSpace(time) || !time.Any(char.IsDigit))
|
||||
{
|
||||
CS2_SimpleAdmin._logger?.LogError("Time string cannot be null or empty.");
|
||||
// CS2_SimpleAdmin._logger?.LogError("Time string cannot be null or empty.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (time.Equals($"0"))
|
||||
return 0;
|
||||
|
||||
var timeUnits = new Dictionary<string, int>
|
||||
{
|
||||
{ "m", 1 }, // Minute
|
||||
@@ -265,8 +285,8 @@ internal static class Helper
|
||||
throw new ArgumentException($"Invalid time unit '{unit}' in time string.", nameof(time));
|
||||
}
|
||||
}
|
||||
|
||||
return totalMinutes;
|
||||
|
||||
return totalMinutes > 0 ? totalMinutes : -1;
|
||||
}
|
||||
|
||||
public static void PrintToCenterAll(string message)
|
||||
|
||||
Reference in New Issue
Block a user