From d76f62b863edd7f2e9f30130520bef79d0a52a4f Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Wed, 8 Oct 2014 14:34:10 -0700 Subject: [PATCH 1/2] Allow Steam IDs in Steam3 format for sm_addban --- plugins/basebans.sp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/basebans.sp b/plugins/basebans.sp index 363a2f5b..692195f2 100644 --- a/plugins/basebans.sp +++ b/plugins/basebans.sp @@ -301,7 +301,13 @@ public Action:Command_AddBan(client, args) } /* Verify steamid */ - if (strncmp(authid, "STEAM_", 6) != 0 || authid[7] != ':') + new bool:idValid = false; + if (!strncmp(authid, "STEAM_", 6) && authid[7] == ':') + idValid = true; + else if (!strcmp(authid, "[U:", 3)) + idValid = true; + + if (!idValid) { ReplyToCommand(client, "[SM] %t", "Invalid SteamID specified"); return Plugin_Handled; @@ -342,13 +348,13 @@ public Action:Command_Unban(client, args) ReplaceString(arg, sizeof(arg), "\"", ""); new ban_flags; - if (strncmp(arg, "STEAM_", 6) == 0 && arg[7] == ':') + if (IsCharNumeric(arg[0])) { - ban_flags |= BANFLAG_AUTHID; + ban_flags |= BANFLAG_IP; } else { - ban_flags |= BANFLAG_IP; + ban_flags |= BANFLAG_AUTHID; } LogAction(client, -1, "\"%L\" removed ban (filter \"%s\")", client, arg); From a3336b1dcf3e5eed1c1976068b500fe1b9d460f6 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Wed, 8 Oct 2014 18:02:05 -0700 Subject: [PATCH 2/2] Fix typo causing compile error strcmp -> strncmp --- plugins/basebans.sp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/basebans.sp b/plugins/basebans.sp index 692195f2..f3a8d53e 100644 --- a/plugins/basebans.sp +++ b/plugins/basebans.sp @@ -304,7 +304,7 @@ public Action:Command_AddBan(client, args) new bool:idValid = false; if (!strncmp(authid, "STEAM_", 6) && authid[7] == ':') idValid = true; - else if (!strcmp(authid, "[U:", 3)) + else if (!strncmp(authid, "[U:", 3)) idValid = true; if (!idValid)