From 375d6aa0da6a15935f85b908148803fbaed0099b Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Sun, 30 Mar 2008 19:28:36 +0000 Subject: [PATCH] Added amb1263: A new flag in users.ini, 'k' implies name/tags are case sensitive --- configs/users.ini | 3 ++ plugins/admin.sma | 57 ++++++++++++++++++++++++++++-------- plugins/include/amxconst.inc | 1 + 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/configs/users.ini b/configs/users.ini index 2ae894bd..8d677c3e 100755 --- a/configs/users.ini +++ b/configs/users.ini @@ -33,6 +33,9 @@ ; c - this is steamid/wonid ; d - this is ip ; e - password is not checked (only name/ip/steamid needed) +; k - name or tag is case sensitive. eg: if you set it so the name "Ham" +; is protected and case sensitive (flags "k" only), then anybody +; can use the names "haM", "HAM", "ham", etc, but not "Ham" ; Password: ; Add to your autoexec.cfg: setinfo _pw "" diff --git a/plugins/admin.sma b/plugins/admin.sma index cce65a4d..b10f97c1 100755 --- a/plugins/admin.sma +++ b/plugins/admin.sma @@ -54,7 +54,7 @@ new PLUGINNAME[] = "AMX Mod X" #define ADMIN_NAME (1<<4) new g_cmdLoopback[16] - +new bool:g_CaseSensitiveName[33]; // pcvars new amx_mode; @@ -122,7 +122,10 @@ public plugin_init() loadSettings(configsDir) // Load admins accounts #endif } - +public client_connect(id) +{ + g_CaseSensitiveName[id] = false; +} public addadminfn(id, level, cid) { if (!cmd_access(id, level, cid, 3)) @@ -662,19 +665,40 @@ getAccess(id, name[], authid[], ip[], password[]) } else { - if (Flags & FLAG_TAG) + if (Flags & FLAG_CASE_SENSITIVE) { - if (containi(name, AuthData) != -1) + if (Flags & FLAG_TAG) + { + if (contain(name, AuthData) != -1) + { + index = i + g_CaseSensitiveName[id] = true + break + } + } + else if (equal(name, AuthData)) + { + index = i + g_CaseSensitiveName[id] = true + break + } + } + else + { + if (Flags & FLAG_TAG) + { + if (containi(name, AuthData) != -1) + { + index = i + break + } + } + else if (equali(name, AuthData)) { index = i break } } - else if (equali(name, AuthData)) - { - index = i - break - } } } @@ -805,11 +829,20 @@ public client_infochanged(id) get_user_name(id, oldname, 31) get_user_info(id, "name", newname, 31) - if (!equali(newname, oldname)) + if (g_CaseSensitiveName[id]) { - accessUser(id, newname) + if (!equal(newname, oldname)) + { + accessUser(id, newname) + } + } + else + { + if (!equali(newname, oldname)) + { + accessUser(id, newname) + } } - return PLUGIN_CONTINUE } diff --git a/plugins/include/amxconst.inc b/plugins/include/amxconst.inc index 2f76fa7c..ede4d888 100755 --- a/plugins/include/amxconst.inc +++ b/plugins/include/amxconst.inc @@ -45,6 +45,7 @@ #define FLAG_AUTHID (1<<2) /* flag "c" */ #define FLAG_IP (1<<3) /* flag "d" */ #define FLAG_NOPASS (1<<4) /* flag "e" */ +#define FLAG_CASE_SENSITIVE (1<<10) /* flag "k" */ #define PLUGIN_CONTINUE 0 /* Results returned by public functions */ #define PLUGIN_HANDLED 1 /* stop other plugins */