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

MySQL Problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kryptonyte
Senior Member
Join Date: Aug 2004
Location: South Carrolinaa
Old 08-27-2004 , 20:10   MySQL Problems
Reply With Quote #1

I've updated to AMX X v.0.20 and it seems all my plugins that use MySQL no longer work. They all show up as not finding mysql functions. Ive activated MySQL in my modules.ini and everything but none of the plugins are functioning properly.
The plugins are: Psychostats v.2.2, AMXBans v.3. They are fully up to date and I've recompiled them several times already.
When compiling the AMX Bans plugins i get this
Code:
//AMXXSC compile.exe
// by the AMX Mod X Dev Team


//// admin_mysql.sma
// C:\scripting\include\mysql.inc(14) : fatal error 100: cannot read from file:
"dbi"
//
// Compilation aborted.
// 1 Error.
// Could not locate output file compiled\admin_mysql.amx (compile failed).
//
// Compilation Time: 0.28 sec
// ----------------------------------------

//// amxbans.sma
// C:\scripting\include\mysql.inc(14) : fatal error 100: cannot read from file:
"dbi"
//
// Compilation aborted.
// 1 Error.
// Could not locate output file compiled\amxbans.amx (compile failed).
//
// Compilation Time: 0.03 sec
// ----------------------------------------

Press enter to exit ..
My server specs are:
STEAM Windows Dedicated Server
Metamod 1.17.2
AMX X v.0.20
EntMod v.3

Any suggestions[/small][/code]
kryptonyte is offline
Send a message via ICQ to kryptonyte Send a message via AIM to kryptonyte Send a message via MSN to kryptonyte Send a message via Yahoo to kryptonyte
DopeFish
Senior Member
Join Date: Feb 2004
Old 08-27-2004 , 21:31  
Reply With Quote #2

did you rewrite the plugins to use the new dbi interface?
DopeFish is offline
Send a message via ICQ to DopeFish
kryptonyte
Senior Member
Join Date: Aug 2004
Location: South Carrolinaa
Old 08-27-2004 , 21:35  
Reply With Quote #3

i don't have any knowledge of the scripting language so i need someone else who can fix them or soemone to tell me what i need to change
kryptonyte is offline
Send a message via ICQ to kryptonyte Send a message via AIM to kryptonyte Send a message via MSN to kryptonyte Send a message via Yahoo to kryptonyte
kryptonyte
Senior Member
Join Date: Aug 2004
Location: South Carrolinaa
Old 08-29-2004 , 09:11  
Reply With Quote #4

anyone? uch:
kryptonyte is offline
Send a message via ICQ to kryptonyte Send a message via AIM to kryptonyte Send a message via MSN to kryptonyte Send a message via Yahoo to kryptonyte
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 08-29-2004 , 11:48  
Reply With Quote #5

Yes...the you need to post the problematic Mysqls here or fix them yourself. Such as:

Code:
new mysql = mysql_connect(host,user,pass,db,error,127) if(mysql < 1) {      server_print("[AMXX] MySQL error: can't connect: '%s'",error)      return PLUGIN_HANDLED }

Should look like this:

Code:
new Sql:sql = dbi_connect(host,user,pass,db,error,127) if(sql <= SQL_FAILED) {     server_print("[AMXX] %L",LANG_SERVER,"SQL_CANT_CON",error)     return PLUGIN_HANDLED }

Then a query:

Code:
if(mysql_query(mysql,"SELECT auth,password,access,flags FROM admins") < 1) {     mysql_error(mysql,error,127)     server_print("[AMXX] MySQL error: can't load admins: '%s'",error)     return PLUGIN_HANDLED }

Will be like so:

Code:
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("[AMXX] %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("[AMXX] %L",LANG_SERVER,"NO_ADMINS")     dbi_free_result(Res)     dbi_close(Sql)     return PLUGIN_HANDLED }

Now to get the fields etx it was:

Code:
while( mysql_nextrow(mysql) > 0 ) {     mysql_getfield(mysql, 1, g_aName[ g_aNum ] ,31)     mysql_getfield(mysql, 2, g_aPassword[ g_aNum ] ,31)     mysql_getfield(mysql, 3, szAccess,31)     mysql_getfield(mysql, 4, szFlags,31)     if ( (containi(szAccess,"z")==-1) && (containi(szAccess,"y")==-1) )       szAccess[strlen(szAccess)] = 'y'     g_aAccess[ g_aNum ] = read_flags( szAccess )     g_aFlags[ g_aNum ] = read_flags( szFlags )     ++g_aNum }

Now its:

Code:
while( dbi_nextrow(Res) > 0 ) {     dbi_field(Res, 1, g_aName[g_aNum], 31)     dbi_field(Res, 2, g_aPassword[g_aNum], 31)     dbi_field(Res, 3, szAccess, 31)     dbi_field(Res, 4, szFlags, 31)     g_aAccess[ g_aNum ] = read_flags( szAccess )     g_aFlags[ g_aNum ] = read_flags( szFlags )     ++g_aNum }

Or you can get fields by name now:

Code:
while( dbi_nextrow(Res) > 0 ) {     dbi_result(Res, "auth", g_aName[g_aNum], 31)     dbi_result(Res, "password", g_aPassword[g_aNum], 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 }

Now there are also alot of new checking you can use and result comparisons such as:

Code:
enum Sql {     SQL_FAILED=0, // Nothing     SQL_OK            // Were good to go } enum Result {     RESULT_FAILED=-1, // Bad result     RESULT_NONE,        // Query went through but returned nothing     RESULT_OK             // Query went through and got a result }

Now you can also goto the wiki and look up the dbi interface:

http://www.amxmodx.org/funcwiki.php

Specifically:

http://www.amxmodx.org/funcwiki.php?go=inc&id=12

Well I hope this helps...and maybe it should be stickied!

Cheers!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
kryptonyte
Senior Member
Join Date: Aug 2004
Location: South Carrolinaa
Old 08-29-2004 , 13:51  
Reply With Quote #6

yeah i think i can do it myself, if not i will post them back here for you or someone else to fix. im a n00b at this small stuff but i have the determination to at least try. who knows maybe i will write my own plugin some day
__________________

Kaboom Clan Site
Visit Kaboom Counter-Strike 1.6 Server: 24.88.56.188:27015
Visit Kaboom DOD Server: 24.88.56.188:2030
kryptonyte is offline
Send a message via ICQ to kryptonyte Send a message via AIM to kryptonyte Send a message via MSN to kryptonyte Send a message via Yahoo to kryptonyte
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 00:22.


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