Added amb1263: A new flag in users.ini, 'k' implies name/tags are case sensitive

This commit is contained in:
Steve Dudenhoeffer 2008-03-30 19:28:36 +00:00
parent 4c4fde8bf3
commit 375d6aa0da
3 changed files with 49 additions and 12 deletions

View File

@ -33,6 +33,9 @@
; c - this is steamid/wonid ; c - this is steamid/wonid
; d - this is ip ; d - this is ip
; e - password is not checked (only name/ip/steamid needed) ; 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: ; Password:
; Add to your autoexec.cfg: setinfo _pw "<password>" ; Add to your autoexec.cfg: setinfo _pw "<password>"

View File

@ -54,7 +54,7 @@ new PLUGINNAME[] = "AMX Mod X"
#define ADMIN_NAME (1<<4) #define ADMIN_NAME (1<<4)
new g_cmdLoopback[16] new g_cmdLoopback[16]
new bool:g_CaseSensitiveName[33];
// pcvars // pcvars
new amx_mode; new amx_mode;
@ -122,7 +122,10 @@ public plugin_init()
loadSettings(configsDir) // Load admins accounts loadSettings(configsDir) // Load admins accounts
#endif #endif
} }
public client_connect(id)
{
g_CaseSensitiveName[id] = false;
}
public addadminfn(id, level, cid) public addadminfn(id, level, cid)
{ {
if (!cmd_access(id, level, cid, 3)) if (!cmd_access(id, level, cid, 3))
@ -662,19 +665,40 @@ getAccess(id, name[], authid[], ip[], password[])
} }
else 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 index = i
break 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_name(id, oldname, 31)
get_user_info(id, "name", newname, 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 return PLUGIN_CONTINUE
} }

View File

@ -45,6 +45,7 @@
#define FLAG_AUTHID (1<<2) /* flag "c" */ #define FLAG_AUTHID (1<<2) /* flag "c" */
#define FLAG_IP (1<<3) /* flag "d" */ #define FLAG_IP (1<<3) /* flag "d" */
#define FLAG_NOPASS (1<<4) /* flag "e" */ #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_CONTINUE 0 /* Results returned by public functions */
#define PLUGIN_HANDLED 1 /* stop other plugins */ #define PLUGIN_HANDLED 1 /* stop other plugins */