Added amb1263: A new flag in users.ini, 'k' implies name/tags are case sensitive
This commit is contained in:
parent
4c4fde8bf3
commit
375d6aa0da
|
@ -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 "<password>"
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue
Block a user