Added CS_IsValidWeaponID native and validity checks to other natives (
bug 5566, r=psychonic).
3 * =============================================================================
4 * SourceMod Map Management Plugin
5 * Provides all map related functionality, including map changing, map voting,
8 * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
9 * =============================================================================
11 * This program is free software; you can redistribute it and/or modify it under
12 * the terms of the GNU General Public License, version 3.0, as published by the
13 * Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 * You should have received a copy of the GNU General Public License along with
21 * this program. If not, see <http://www.gnu.org/licenses/>.
23 * As a special exception, AlliedModders LLC gives you permission to link the
24 * code of this program (as well as its derivative works) to "Half-Life 2," the
25 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
26 * by the Valve Corporation. You must obey the GNU General Public License in
27 * all respects for all other code used. Additionally, AlliedModders LLC grants
28 * this exception to all derivative works. AlliedModders LLC defines further
29 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
30 * or <http://www.sourcemod.net/license.php>.
38 #include <clientprefs>
40 public Plugin:myinfo =
42 name = "Client Preferences",
43 author = "AlliedModders LLC",
44 description = "Client peferences and settings menu",
45 version = SOURCEMOD_VERSION,
46 url = "http://www.sourcemod.net/"
49 public OnPluginStart()
51 LoadTranslations("clientprefs.phrases");
53 RegConsoleCmd("sm_cookies", Command_Cookie, "sm_cookies <name> [value]");
54 RegConsoleCmd("sm_settings", Command_Settings);
57 public Action:Command_Cookie(client, args)
61 ReplyToCommand(client, "[SM] Usage: sm_cookies <name> [value]");
62 ReplyToCommand(client, "[SM] %t", "Printing Cookie List");
64 /* Show list of cookies */
65 new Handle:iter = GetCookieIterator();
69 decl String:description[255];
70 description[0] = '\0';
72 PrintToConsole(client, "%t:", "Cookie List");
74 new CookieAccess:access;
76 while (ReadCookieIterator(iter,
81 sizeof(description)) != false)
83 if (access < CookieAccess_Private)
85 PrintToConsole(client, "%s - %s", name, description);
90 return Plugin_Handled;
95 PrintToServer("%T", "No Console", LANG_SERVER);
96 return Plugin_Handled;
101 GetCmdArg(1, name, sizeof(name));
103 new Handle:cookie = FindClientCookie(name);
105 if (cookie == INVALID_HANDLE)
107 ReplyToCommand(client, "[SM] %t", "Cookie not Found", name);
108 return Plugin_Handled;
111 new CookieAccess:access = GetCookieAccess(cookie);
113 if (access == CookieAccess_Private)
115 ReplyToCommand(client, "[SM] %t", "Cookie not Found", name);
117 return Plugin_Handled;
120 decl String:value[100];
125 GetClientCookie(client, cookie, value, sizeof(value));
126 ReplyToCommand(client, "[SM] %t", "Cookie Value", name, value);
129 return Plugin_Handled;
132 if (access == CookieAccess_Protected)
134 ReplyToCommand(client, "[SM] %t", "Protected Cookie", name);
136 return Plugin_Handled;
139 /* Set the new value of the cookie */
141 GetCmdArg(2, value, sizeof(value));
143 SetClientCookie(client, cookie, value);
145 ReplyToCommand(client, "[SM] %t", "Cookie Changed Value", name, value);
147 return Plugin_Handled;
150 public Action:Command_Settings(client, args)
154 PrintToServer("%T", "No Console", LANG_SERVER);
155 return Plugin_Handled;
158 ShowCookieMenu(client);
160 return Plugin_Handled;