From 733e33e82aa88dd8c93b37ff71c5a0f697bd1008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20=C4=8C=2E?= Date: Thu, 1 Jan 2026 13:01:24 +0100 Subject: [PATCH] Fix a bug where ban reason is used as ban duration (#2383) In basebans there are 3 commands for banning: banip,addban,ban They have required arguments for ban duration and optional arguments for ban reason. However the functions that process the arguments do not properly validate the duration and if reason is provided instead of duration, the functions just convert that string into an integer and use it as the ban duration. This usually results in a permaban with an empty reason. This commit adds a loop for checking duration chars to be numeric before converting them to an int. --- plugins/basebans.sp | 28 +++++++++++++++++++++++----- plugins/basebans/ban.sp | 9 +++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/plugins/basebans.sp b/plugins/basebans.sp index 081faab6..0bd9a772 100644 --- a/plugins/basebans.sp +++ b/plugins/basebans.sp @@ -76,8 +76,8 @@ public void OnPluginStart() RegAdminCmd("sm_ban", Command_Ban, ADMFLAG_BAN, "sm_ban <#userid|name> [reason]"); RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban "); - RegAdminCmd("sm_addban", Command_AddBan, ADMFLAG_RCON, "sm_addban