diff --git a/plugins/clientprefs.sp b/plugins/clientprefs.sp index 74e7f9f2..d22fa3aa 100644 --- a/plugins/clientprefs.sp +++ b/plugins/clientprefs.sp @@ -67,24 +67,19 @@ public Action Command_Cookie(int client, int args) Handle iter = GetCookieIterator(); char name[30]; - name[0] = '\0'; char description[255]; - description[0] = '\0'; PrintToConsole(client, "%t:", "Cookie List"); CookieAccess access; - while (ReadCookieIterator(iter, - name, - sizeof(name), - access, - description, - sizeof(description)) != false) + int count = 1; + + while (ReadCookieIterator(iter, name, sizeof(name), access, description, sizeof(description)) != false) { if (access < CookieAccess_Private) { - PrintToConsole(client, "%s - %s", name, description); + PrintToConsole(client, "[%03d] %s - %s", count++, name, description); } } @@ -99,7 +94,7 @@ public Action Command_Cookie(int client, int args) } char name[30]; - name[0] = '\0'; + GetCmdArg(1, name, sizeof(name)); Handle cookie = FindClientCookie(name); @@ -120,17 +115,33 @@ public Action Command_Cookie(int client, int args) } char value[100]; - value[0] = '\0'; if (args == 1) { + Handle iter = GetCookieIterator(); + GetClientCookie(client, cookie, value, sizeof(value)); ReplyToCommand(client, "[SM] %t", "Cookie Value", name, value); + char CookieName[30]; + char description[255]; + + while (ReadCookieIterator(iter, CookieName, sizeof(CookieName), access, description, sizeof(description)) != false) // We're allowed to re-use access since we're about to return anyways. + { + if (StrEqual(CookieName, name, true)) + { + TrimString(description); + if (description[0] != EOS) + ReplyToCommand(client, "- %s", description); + + break; + } + } + + delete iter; delete cookie; return Plugin_Handled; } - if (access == CookieAccess_Protected) { ReplyToCommand(client, "[SM] %t", "Protected Cookie", name);