From e5afdb418173ed9a25bb599cb37ad248d8d5d995 Mon Sep 17 00:00:00 2001 From: iNilo Date: Tue, 1 Feb 2022 19:13:06 +0100 Subject: [PATCH] adminhelp.sp -> Switch to the new CommandIterator() (#1388) * Switch to the new CommandIterator() methodmap `ReadCommandIterator` -> ``` CmdIter.GetName(Name, sizeof(Name)); Flags = CmdIter.Flags; CmdIter.GetDescription(Desc, sizeof(Desc)); ``` * PeaceMaker fixes * Don't fetch unused properties Co-authored-by: Michael Flaherty Co-authored-by: Peace-Maker --- plugins/adminhelp.sp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/plugins/adminhelp.sp b/plugins/adminhelp.sp index ebd6a0d6..518c5a63 100644 --- a/plugins/adminhelp.sp +++ b/plugins/adminhelp.sp @@ -86,17 +86,19 @@ public Action HelpCmd(int client, int args) char Name[64]; char Desc[255]; char NoDesc[128]; - int Flags; - Handle CmdIter = GetCommandIterator(); + CommandIterator CmdIter = new CommandIterator(); FormatEx(NoDesc, sizeof(NoDesc), "%T", "No description available", client); if (DoSearch) { int i = 1; - while (ReadCommandIterator(CmdIter, Name, sizeof(Name), Flags, Desc, sizeof(Desc))) + while (CmdIter.Next()) { - if ((StrContains(Name, arg, false) != -1) && CheckCommandAccess(client, Name, Flags)) + CmdIter.GetName(Name, sizeof(Name)); + CmdIter.GetDescription(Desc, sizeof(Desc)); + + if ((StrContains(Name, arg, false) != -1) && CheckCommandAccess(client, Name, CmdIter.Flags)) { PrintToConsole(client, "[%03d] %s - %s", i++, Name, (Desc[0] == '\0') ? NoDesc : Desc); } @@ -114,9 +116,11 @@ public Action HelpCmd(int client, int args) { int i; int EndCmd = (PageNum-1) * COMMANDS_PER_PAGE - 1; - for (i=0; ReadCommandIterator(CmdIter, Name, sizeof(Name), Flags, Desc, sizeof(Desc)) && i