mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 14:25:38 +03:00
added amx_reloadadmins
This commit is contained in:
parent
7ff9ac8ab6
commit
e6ebccd269
@ -40,7 +40,7 @@ new g_aPassword[MAX_ADMINS][32]
|
|||||||
new g_aName[MAX_ADMINS][32]
|
new g_aName[MAX_ADMINS][32]
|
||||||
new g_aFlags[MAX_ADMINS]
|
new g_aFlags[MAX_ADMINS]
|
||||||
new g_aAccess[MAX_ADMINS]
|
new g_aAccess[MAX_ADMINS]
|
||||||
new g_aNum
|
new g_aNum = 0
|
||||||
#if !defined NO_STEAM
|
#if !defined NO_STEAM
|
||||||
new g_cmdLoopback[16]
|
new g_cmdLoopback[16]
|
||||||
#endif
|
#endif
|
||||||
@ -59,6 +59,8 @@ public plugin_init()
|
|||||||
register_cvar("amx_last_voting","0")
|
register_cvar("amx_last_voting","0")
|
||||||
set_cvar_float("amx_last_voting",0.0)
|
set_cvar_float("amx_last_voting",0.0)
|
||||||
|
|
||||||
|
register_concmd("amx_reloadadmins","cmdReload",ADMIN_ADMIN)
|
||||||
|
|
||||||
#if !defined NO_STEAM
|
#if !defined NO_STEAM
|
||||||
format( g_cmdLoopback, 15, "amxauth%c%c%c%c" ,
|
format( g_cmdLoopback, 15, "amxauth%c%c%c%c" ,
|
||||||
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
|
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
|
||||||
@ -96,10 +98,25 @@ loadSettings(szFilename[])
|
|||||||
g_aFlags[ g_aNum ] = read_flags( szFlags )
|
g_aFlags[ g_aNum ] = read_flags( szFlags )
|
||||||
++g_aNum
|
++g_aNum
|
||||||
}
|
}
|
||||||
|
server_print("Loaded %d admin%s from file",g_aNum, (g_aNum == 1) ? "" : "s" )
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public cmdReload(id,level,cid)
|
||||||
|
{
|
||||||
|
if (!cmd_access(id,level,cid,1))
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
|
new filename[64]
|
||||||
|
get_basedir(filename,31)
|
||||||
|
format(filename,63,"%s/configs/users.ini",filename)
|
||||||
|
|
||||||
|
g_aNum = 0
|
||||||
|
loadSettings(filename) // Re-Load admins accounts
|
||||||
|
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
}
|
||||||
|
|
||||||
getAccess(id,name[],authid[],ip[], password[])
|
getAccess(id,name[],authid[],ip[], password[])
|
||||||
{
|
{
|
||||||
new index = -1
|
new index = -1
|
||||||
|
@ -40,7 +40,7 @@ new g_aPassword[MAX_ADMINS][32]
|
|||||||
new g_aName[MAX_ADMINS][32]
|
new g_aName[MAX_ADMINS][32]
|
||||||
new g_aFlags[MAX_ADMINS]
|
new g_aFlags[MAX_ADMINS]
|
||||||
new g_aAccess[MAX_ADMINS]
|
new g_aAccess[MAX_ADMINS]
|
||||||
new g_aNum
|
new g_aNum = 0
|
||||||
#if !defined NO_STEAM
|
#if !defined NO_STEAM
|
||||||
new g_cmdLoopback[16]
|
new g_cmdLoopback[16]
|
||||||
#endif
|
#endif
|
||||||
@ -68,6 +68,8 @@ public plugin_init()
|
|||||||
register_cvar("amx_last_voting","0")
|
register_cvar("amx_last_voting","0")
|
||||||
set_cvar_float("amx_last_voting",0.0)
|
set_cvar_float("amx_last_voting",0.0)
|
||||||
|
|
||||||
|
register_concmd("amx_reloadadmins","cmdReload",ADMIN_ADMIN)
|
||||||
|
|
||||||
#if !defined NO_STEAM
|
#if !defined NO_STEAM
|
||||||
format( g_cmdLoopback, 15, "amxauth%c%c%c%c" ,
|
format( g_cmdLoopback, 15, "amxauth%c%c%c%c" ,
|
||||||
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
|
random_num('A','Z') , random_num('A','Z') ,random_num('A','Z'),random_num('A','Z') )
|
||||||
@ -82,7 +84,7 @@ public plugin_init()
|
|||||||
server_cmd("exec %s/configs/mysql.cfg;amx_sqladmins" , filename)
|
server_cmd("exec %s/configs/mysql.cfg;amx_sqladmins" , filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
public adminSql(){
|
public adminSql() {
|
||||||
new host[64],user[32],pass[32],db[32],error[128]
|
new host[64],user[32],pass[32],db[32],error[128]
|
||||||
get_cvar_string("amx_mysql_host",host,63)
|
get_cvar_string("amx_mysql_host",host,63)
|
||||||
get_cvar_string("amx_mysql_user",user,31)
|
get_cvar_string("amx_mysql_user",user,31)
|
||||||
@ -104,7 +106,6 @@ public adminSql(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
new szFlags[32],szAccess[32]
|
new szFlags[32],szAccess[32]
|
||||||
g_aNum = 0 /* reset admins settings */
|
|
||||||
while( mysql_nextrow(mysql) > 0 )
|
while( mysql_nextrow(mysql) > 0 )
|
||||||
{
|
{
|
||||||
mysql_getfield(mysql, 1, g_aName[ g_aNum ] ,31)
|
mysql_getfield(mysql, 1, g_aName[ g_aNum ] ,31)
|
||||||
@ -125,6 +126,17 @@ public adminSql(){
|
|||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public cmdReload(id,level,cid)
|
||||||
|
{
|
||||||
|
if (!cmd_access(id,level,cid,1))
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
|
||||||
|
g_aNum = 0
|
||||||
|
adminSql() // Re-Load admins accounts
|
||||||
|
|
||||||
|
return PLUGIN_HANDLED
|
||||||
|
}
|
||||||
|
|
||||||
getAccess(id,name[],authid[],ip[], password[]){
|
getAccess(id,name[],authid[],ip[], password[]){
|
||||||
new index = -1
|
new index = -1
|
||||||
new result = 0
|
new result = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user