Raised This Month: $51 Target: $400
 12% 

MySQL Files for AMX Mod X


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FeliX
Junior Member
Join Date: Apr 2004
Old 11-21-2004 , 17:23   MySQL Files for AMX Mod X
Reply With Quote #1

Hi, I've been using the script below for alot of time, both for AMX amd AMXX - originally developed by NoPlay and slightly modified by my self for supporting multiple servers and suiting my needs.

To night i wanted to start upgrading my servers for version 1.0 of AMXX, but this very important plugin to me doesn't work after being compiled for AMXX.
Since it's a very small plugin i asumed that it wouldn't be hard for an expirienced small programmer to correct it or make an alternative, so therefore i guessed it would be worth a shot posting it here.

Code:
/* AMX Mod script. * * (c) Copyright 2002, Noplay * This file is provided as is (no warranties). * */ /* This AMX plugin requires MySQL MetaSmall module. For the plugin to work, you need the MySQL table, it can be created with this SQL query: CREATE TABLE `amx_files` (   `id` int(11) NOT NULL auto_increment,   `serverid` int(11) NOT NULL default '0',   `file` varchar(100) NOT NULL default '',   `content` mediumtext NOT NULL,   PRIMARY KEY  (`id`) ) TYPE=MyISAM; To configure your MySQL informations, go to the addons/amx/mysql.cfg file and edit it. Files specified with the serverid 0 will be loaded at all servers, files with a special serverid will only be loaded at the servers configured with that serverid. To set your servers serverid, type this in your server config: amx_serverid X replace X with your servers id (eg. amx_serverid 1). OBS! This plugin was original developed by NoPlay, and re-written for multiply server support by FeliX. Thanks to GeekGod for help. */ #include  <amxmod> #include  <mysql> public load_files() { new mysql,cnt new file[65] new content[3025] new error[257] new host[65] new user[33] new pass[33] new db[33] // GG new string[98] get_cvar_string("amx_mysql_host",host,64) get_cvar_string("amx_mysql_user",user,32) get_cvar_string("amx_mysql_pass",pass,32) get_cvar_string("amx_mysql_db",db,32) mysql = mysql_connect(host,user,pass,db,error,256) if(mysql>0) { format(string,98,"SELECT file,content FROM amx_files where serverid = 0 or serverid = %d order by serverid ASC",get_cvar_num("amx_serverid")) if(mysql_query(mysql,string) >0) { cnt = 0 while(mysql_nextrow(mysql)>0) { mysql_getfield(mysql,1,file,32) mysql_getfield(mysql,2,content,3024) delete_file(file) write_file(file,content); cnt++ } server_print("[AMX] Loaded %d file(s) from database",cnt) } else { mysql_error(mysql,error,32) server_print("[AMX] MySQL error : could not load file : '%s'",error) } mysql_close(mysql) } else { server_print("[AMX] MySQL error : could not connect : '%s'",error) } return PLUGIN_HANDLED } public plugin_init() { register_plugin("MySQL Files","2","NoPlay") register_cvar("amx_mysql_host","127.0.0.1") register_cvar("amx_mysql_user","root") register_cvar("amx_mysql_pass","") register_cvar("amx_mysql_db","amx") register_cvar("amx_serverid","1") set_task(5.0,"load_files") server_cmd("exec server.cfg") return PLUGIN_CONTINUE }

When running it on my AMX Mod X based server I'm getting a fatal error causing the server to crash:

Quote:
L 11/21/2004 - 23:17:25: [AMXX] Run time error 10 (native) (plugin "mysql_files.amxx") - debug not enabled.
L 11/21/2004 - 23:17:25: [MySQL] Unknown error
L 11/21/2004 - 23:17:25: [AMXX] To enable debug mode, add " debug" after the plugin name in plugins.ini (without quotes).
L 11/21/2004 - 23:17:25: [AMXX] Run time error 10 (native) (plugin "mysql_files.amxx") - debug not enabled.
L 11/21/2004 - 23:17:25: [AMXX] To enable debug mode, add " debug" after the plugin name in plugins.ini (without quotes).
/home/gameserver/cs01/hlds_run: line 57: 8763 Segmentation fault $HL_CMD
Add "-debug" to the /home/gameserver/cs01/hlds_run command line to generate a debug.log to help with solving this problem
Sun Nov 21 23:17:25 CET 2004: Server restart in 10 seconds
Sun Nov 21 23:171 CET 2004: Server Quit
I hope that someone has got the time and perhaps the needs to do this
Thank you.
FeliX is offline
LoWe
Member
Join Date: Mar 2004
Old 11-23-2004 , 14:55  
Reply With Quote #2

Its on the plugins forum: here.
LoWe is offline
Send a message via Skype™ to LoWe
FeliX
Junior Member
Join Date: Apr 2004
Old 11-23-2004 , 15:04  
Reply With Quote #3

Thank you very much - very nice work, it runs perfectly!
Go get it posted in the Plugins section so other people can enjoy your nice piece of work too
FeliX is offline
LoWe
Member
Join Date: Mar 2004
Old 11-23-2004 , 15:25  
Reply With Quote #4

Thought about it but i need to test the error handling stuff before and invest some in the copyright stuff before i release it.
LoWe is offline
Send a message via Skype™ to LoWe
Reply



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 01:55.


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