如何改变users.ini的存放路径?
我用的是AMXXMOD 1.0 ,我想把users.ini文件放在别的文件夹里,怎么修改才可以?谢谢~
admin.sma
#if defined USING_SQLpublic adminSql() {
new host,user,pass,db,table,error
get_cvar_string("amx_sql_host",host,63)
get_cvar_string("amx_sql_user",user,31)
get_cvar_string("amx_sql_pass",pass,31)
get_cvar_string("amx_sql_db",db,31)
get_cvar_string("amx_sql_table",table,31)
new Sql:sql = dbi_connect(host,user,pass,db,error,127)
if (sql <= SQL_FAILED) {
server_print("%L",LANG_SERVER,"SQL_CANT_CON",error)
//backup to users.ini
new configsDir
get_configsdir(configsDir, 63)
format(configsDir, 63, "%s/users.ini", configsDir)
loadSettings(configsDir) // Load admins accounts
return PLUGIN_HANDLED
}
dbi_query(sql,"CREATE TABLE IF NOT EXISTS `%s` ( `auth` VARCHAR( 32 ) NOT NULL, `password` VARCHAR( 32 ) NOT NULL, `access` VARCHAR( 32 ) NOT NULL, `flags` VARCHAR( 32 ) NOT NULL ) COMMENT = 'AMX Mod X Admins'",table)
new Result:Res = dbi_query(sql,"SELECT `auth`,`password`,`access`,`flags` FROM `%s`",table)
if (Res == RESULT_FAILED) {
dbi_error(sql,error,127)
server_print("%L",LANG_SERVER,"SQL_CANT_LOAD_ADMINS",error)
dbi_free_result(Res)
dbi_close(sql)
return PLUGIN_HANDLED
}
else if (Res == RESULT_NONE) {
server_print("%L",LANG_SERVER,"NO_ADMINS")
dbi_free_result(Res)
dbi_close(sql)
return PLUGIN_HANDLED
}
new szFlags,szAccess
g_aNum = 0
while( dbi_nextrow(Res) > 0 ) {
dbi_result(Res, "auth", g_aName, 31)
dbi_result(Res, "password", g_aPassword, 31)
dbi_result(Res, "access", szAccess, 31)
dbi_result(Res, "flags", szFlags, 31)
g_aAccess[ g_aNum ] = read_flags( szAccess )
g_aFlags[ g_aNum ] = read_flags( szFlags )
++g_aNum
}
if (g_aNum == 1)
server_print("%L", LANG_SERVER, "SQL_LOADED_ADMIN" )
else
server_print("%L", LANG_SERVER, "SQL_LOADED_ADMINS", g_aNum )
dbi_free_result(Res)
dbi_close(sql)
return PLUGIN_HANDLED
}
#endif
public cmdReload(id,level,cid) {
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
//strip original flags (patch submitted by mrhunt)
remove_user_flags(0,read_flags("z"))
#if !defined USING_SQL
new filename
get_configsdir(filename,127)
format(filename,63,"%s/users.ini", filename)
g_aNum = 0
loadSettings(filename) // Re-Load admins accounts
if (id != 0) {
if (g_aNum == 1)
console_print(id,"%L", LANG_SERVER, "LOADED_ADMIN" )
else
console_print(id,"%L", LANG_SERVER, "LOADED_ADMINS", g_aNum )
}
#else
adminSql()
if (id != 0) {
if (g_aNum == 1)
console_print(id,"%L", LANG_SERVER, "SQL_LOADED_ADMIN" )
else
console_print(id,"%L", LANG_SERVER, "SQL_LOADED_ADMINS", g_aNum )
}
#endif
return PLUGIN_HANDLED
} 还得配合core.ini吧? 难道改了位置功能就变吗? :43: 只能在addons目录下,不可能超出其他目录。:13:
如果你怕user.ini被他人利用。参考#2的改文件名比较理想。但是其他插件如果要使用这个user.ini话就麻烦了。:43: 晕死了,给各们老大提难题。你不如小心OP密码怎么才会不被人盗走。
页:
[1]