cookies: Align output with sm_help (#977)

* Update clientprefs.sp

* Update clientprefs.sp

* Update clientprefs.sp

* Update clientprefs.sp

* Update clientprefs.sp

* Update clientprefs.sp

* Create natives.sp

* Delete natives.sp
This commit is contained in:
eyal282 2020-07-09 06:38:35 +03:00 committed by GitHub
parent 100f1e56ca
commit 4a4b9ce7f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);