added amx_reloadadmins

This commit is contained in:
Felix Geyer 2004-03-07 10:57:57 +00:00
parent 7ff9ac8ab6
commit e6ebccd269
2 changed files with 37 additions and 8 deletions

View File

@ -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
@ -59,6 +59,8 @@ public plugin_init()
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

View File

@ -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
@ -68,6 +68,8 @@ public plugin_init()
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') )
@ -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