| lucky109 |
04-11-2006 00:56 |
map.ini load in mysql?
Quote:
#include <amxmodx>
#include <dbi>
new Sql:dbc
new Result:result
public plugin_init() {
register_plugin("MySQL Mapcycle","0.1","GDX")
set_task(Float:10.0,"sql_init")
}
public sql_init() {
new host[64], username[32], password[32], dbname[32], error[32]
get_cvar_string("amx_sql_host",host,64)
get_cvar_string("amx_sql_user",username,32)
get_cvar_string("amx_sql_pass",password,32)
get_cvar_string("amx_sql_db",dbname,32)
dbc = dbi_connect(host,username,password,dbname,err or,32)
if (dbc == SQL_FAILED)
log_amx("[AMXX] SQL Connection Failed (MySQL Mapcycle Plugin)")
else
dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `maps` (`map` varchar(32) NOT NULL)")
}
public mapcycle () {
if (dbc == SQL_FAILED) return PLUGIN_HANDLED
result = dbi_query(dbc,"SELECT * FROM maps")
new value[32]
new cnt
cnt = 0
delete_file("mapcycle.txt")
while(dbi_nextrow(result)>0)
{
dbi_result(result,"map",value)
write_file("mapcycle.txt",value,-1)
cnt++
}
server_print("[AMXX] Loaded %d map(s) from database",cnt)
dbi_free_result(result)
dbi_close(dbc)
return PLUGIN_HANDLED
}
|
my amxx map menu is map.ini , not mapcycle.txt
can selects the map from a MySQL Database of map.ini?
|