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
|
; 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>"
|
||||||
|
|
|
@ -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))
|
||||||
|
@ -661,6 +664,26 @@ getAccess(id, name[], authid[], ip[], password[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (Flags & FLAG_CASE_SENSITIVE)
|
||||||
|
{
|
||||||
|
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 (Flags & FLAG_TAG)
|
||||||
{
|
{
|
||||||
|
@ -677,6 +700,7 @@ getAccess(id, name[], authid[], ip[], password[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
|
@ -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 (g_CaseSensitiveName[id])
|
||||||
|
{
|
||||||
|
if (!equal(newname, oldname))
|
||||||
|
{
|
||||||
|
accessUser(id, newname)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (!equali(newname, oldname))
|
if (!equali(newname, oldname))
|
||||||
{
|
{
|
||||||
accessUser(id, newname)
|
accessUser(id, newname)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return PLUGIN_CONTINUE
|
return PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user