Raised This Month: $ Target: $400
 0% 

map.ini load in mysql?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
lucky109
Senior Member
Join Date: Jan 2005
Old 04-11-2006 , 00:56   map.ini load in mysql?
Reply With Quote #1

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?
lucky109 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode