mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +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_aFlags[MAX_ADMINS]
|
||||
new g_aAccess[MAX_ADMINS]
|
||||
new g_aNum
|
||||
new g_aNum = 0
|
||||
#if !defined NO_STEAM
|
||||
new g_cmdLoopback[16]
|
||||
#endif
|
||||
@ -52,13 +52,15 @@ public plugin_init()
|
||||
register_cvar("amx_password_field","_pw")
|
||||
register_cvar("amx_default_access","")
|
||||
|
||||
register_cvar("amx_vote_ratio","0.02")
|
||||
register_cvar("amx_vote_time","10")
|
||||
register_cvar("amx_vote_answers","1")
|
||||
register_cvar("amx_vote_ratio","0.02")
|
||||
register_cvar("amx_vote_time","10")
|
||||
register_cvar("amx_vote_answers","1")
|
||||
register_cvar("amx_vote_delay","60")
|
||||
register_cvar("amx_last_voting","0")
|
||||
set_cvar_float("amx_last_voting",0.0)
|
||||
|
||||
register_concmd("amx_reloadadmins","cmdReload",ADMIN_ADMIN)
|
||||
|
||||
#if !defined NO_STEAM
|
||||
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') )
|
||||
@ -96,10 +98,25 @@ loadSettings(szFilename[])
|
||||
g_aFlags[ g_aNum ] = read_flags( szFlags )
|
||||
++g_aNum
|
||||
}
|
||||
|
||||
server_print("Loaded %d admin%s from file",g_aNum, (g_aNum == 1) ? "" : "s" )
|
||||
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[])
|
||||
{
|
||||
new index = -1
|
||||
|
@ -40,7 +40,7 @@ new g_aPassword[MAX_ADMINS][32]
|
||||
new g_aName[MAX_ADMINS][32]
|
||||
new g_aFlags[MAX_ADMINS]
|
||||
new g_aAccess[MAX_ADMINS]
|
||||
new g_aNum
|
||||
new g_aNum = 0
|
||||
#if !defined NO_STEAM
|
||||
new g_cmdLoopback[16]
|
||||
#endif
|
||||
@ -67,6 +67,8 @@ public plugin_init()
|
||||
register_cvar("amx_vote_delay","60")
|
||||
register_cvar("amx_last_voting","0")
|
||||
set_cvar_float("amx_last_voting",0.0)
|
||||
|
||||
register_concmd("amx_reloadadmins","cmdReload",ADMIN_ADMIN)
|
||||
|
||||
#if !defined NO_STEAM
|
||||
format( g_cmdLoopback, 15, "amxauth%c%c%c%c" ,
|
||||
@ -82,7 +84,7 @@ public plugin_init()
|
||||
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]
|
||||
get_cvar_string("amx_mysql_host",host,63)
|
||||
get_cvar_string("amx_mysql_user",user,31)
|
||||
@ -104,7 +106,6 @@ public adminSql(){
|
||||
}
|
||||
|
||||
new szFlags[32],szAccess[32]
|
||||
g_aNum = 0 /* reset admins settings */
|
||||
while( mysql_nextrow(mysql) > 0 )
|
||||
{
|
||||
mysql_getfield(mysql, 1, g_aName[ g_aNum ] ,31)
|
||||
@ -125,6 +126,17 @@ public adminSql(){
|
||||
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[]){
|
||||
new index = -1
|
||||
new result = 0
|
||||
|
Loading…
Reference in New Issue
Block a user