Skip to content

Commit 2a3f067

Browse files
committed
fix IsValidPlayer bug
1 parent 5870ad2 commit 2a3f067

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

SimpleAdmin.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ private void InitDatabase()
3434
if (Int32.TryParse(command.GetArg(1), out int userId))
3535
{
3636
user = Utilities.GetPlayerFromUserid(userId);
37-
if (IsValidHuman(user)) return user;
37+
if (IsValidPlayer(user, can_be_bot)) return user;
3838
}
3939
user = TryGetPlayerFromName(command.GetArg(1));
40-
if (IsValidHuman(user) || can_be_bot) return user;
40+
if (IsValidPlayer(user, can_be_bot)) return user;
4141
return null;
4242
}
4343

@@ -50,9 +50,9 @@ private void InitDatabase()
5050
}
5151
return null;
5252
}
53-
public bool IsValidHuman(CCSPlayerController? player)
53+
public static bool IsValidPlayer(CCSPlayerController? player, bool can_be_bot = false)
5454
{
55-
return player != null && player.IsValid && !player.IsBot;
55+
return player != null && player.IsValid && (!player.IsBot || can_be_bot);
5656
}
5757

5858

@@ -132,7 +132,7 @@ public void OnCommandPlayers(CCSPlayerController _, CommandInfo command)
132132
{
133133
foreach (var player in Utilities.GetPlayers())
134134
{
135-
if (IsValidHuman(player))
135+
if (IsValidPlayer(player))
136136
{
137137
command.ReplyToCommand($"{player.UserId}: {player.PlayerName}");
138138
}
@@ -199,7 +199,7 @@ private void UnbanUser(BannedUser user)
199199
if (int.TryParse(identifier, out int userId))
200200
{
201201
var player = Utilities.GetPlayerFromUserid(userId);
202-
if (IsValidHuman(player)) return IsUserBanned(player.SteamID);
202+
if (IsValidPlayer(player)) return IsUserBanned(player.SteamID);
203203
}
204204
if (ulong.TryParse(identifier, out ulong steamId))
205205
{

0 commit comments

Comments
 (0)