From 506797935ba582d00fc20af9081b8c62ca935806 Mon Sep 17 00:00:00 2001 From: Joshua Leivers Date: Wed, 3 Jul 2024 00:26:01 +0100 Subject: [PATCH 1/2] Remove hardcoded XGUI hint name for time arguments Time arguments can be used for things other than ban lengths, but having it like this would always show the hint in XGUI of "Ban Length:". --- lua/ulx/modules/cl/xgui_helpers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ulx/modules/cl/xgui_helpers.lua b/lua/ulx/modules/cl/xgui_helpers.lua index 389b31c7..0aaa51d8 100644 --- a/lua/ulx/modules/cl/xgui_helpers.lua +++ b/lua/ulx/modules/cl/xgui_helpers.lua @@ -236,7 +236,7 @@ function xgui.load_helpers() local max = restrictions.max or 10 * 60 * 24 * 365 --default slider max 10 years local outPanel = xlib.makepanel{ h=40, parent=parent } - xlib.makelabel{ x=5, y=3, label="Ban Length:", parent=outPanel } + xlib.makelabel{ x=5, y=3, label=arg.hint or "Time:", parent=outPanel } outPanel.interval = xlib.makecombobox{ x=90, w=75, parent=outPanel } outPanel.val = xlib.makeslider{ w=165, y=20, label="<--->", min=min, max=max, value=min, decimal=0, parent=outPanel } From 8e63be3d947ed27366bde6cf373cd77758a40ce8 Mon Sep 17 00:00:00 2001 From: Joshua Leivers Date: Wed, 3 Jul 2024 00:28:24 +0100 Subject: [PATCH 2/2] Update `ban` and `banid`'s hints for XGUI change XGUI now sets its hint for time arguments based on the parameter's hint, rather than a hardcoded "Ban Length:" value. --- lua/ulx/modules/sh/util.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/ulx/modules/sh/util.lua b/lua/ulx/modules/sh/util.lua index 61c83af7..cb69ef23 100644 --- a/lua/ulx/modules/sh/util.lua +++ b/lua/ulx/modules/sh/util.lua @@ -99,7 +99,7 @@ function ulx.ban( calling_ply, target_ply, minutes, reason ) end local ban = ulx.command( CATEGORY_NAME, "ulx ban", ulx.ban, "!ban", false, false, true ) ban:addParam{ type=ULib.cmds.PlayerArg } -ban:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 } +ban:addParam{ type=ULib.cmds.NumArg, hint="Ban Length", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 } ban:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons } ban:defaultAccess( ULib.ACCESS_ADMIN ) ban:help( "Bans target." ) @@ -142,7 +142,7 @@ function ulx.banid( calling_ply, steamid, minutes, reason ) end local banid = ulx.command( CATEGORY_NAME, "ulx banid", ulx.banid, "!banid", false, false, true ) banid:addParam{ type=ULib.cmds.StringArg, hint="steamid" } -banid:addParam{ type=ULib.cmds.NumArg, hint="minutes, 0 for perma", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 } +banid:addParam{ type=ULib.cmds.NumArg, hint="Ban Length", ULib.cmds.optional, ULib.cmds.allowTimeString, min=0 } banid:addParam{ type=ULib.cmds.StringArg, hint="reason", ULib.cmds.optional, ULib.cmds.takeRestOfLine, completes=ulx.common_kick_reasons } banid:defaultAccess( ULib.ACCESS_SUPERADMIN ) banid:help( "Bans steamid." )