Hello, I'm working with AMXX .20, and the Ultimate Warcraft3 Plugin. The guy hasn't released the source, nor updated, so that's what I have to use.
I'm trying to retrieve the XP # from the database, but so far I have not had luck in doing so.
Code:
public checkXP( id, key[] )
{
mySQLConnect()
if ( gMySQL <= SQL_FAILED) return false
new sql[512], error[128]
new Result:retvalxp
new parms[2]
new sqlxp[48]
server_print("[OMGKEY->] %s",key)
format(sql, 511, "SELECT xp FROM uwc3_xp WHERE steamid='%s'",key)
server_print("[OMGQUERY->] %s",sql)
retvalxp = dbi_query(gMySQL,sql)
if (retvalxp == RESULT_FAILED) {
dbi_error(gMySQL,error,127)
server_print("[SL-UWC3-LEVEL] MySQL XP Retrieval Error: %s",error)
return false
} else if (retvalxp == RESULT_NONE ) {
server_print("[SL-UWC3-LEVEL] This guy is new! Establishing minimum XP value... %s",retvalxp)
parms[0] = id
parms[1] = 0
set_task(5.0,"setXP",id,parms,2)
return true
}
server_print("[OMGRETVAL->] %d",retvalxp)
dbi_result(retvalxp, "xp", sqlxp, 32) // LINE 77
server_print("[OMGSQLXP->] %d %s",sqlxp,sqlxp)
if (sqlxp[32] < minxp ) {
gPlayerXP[id] = str_to_num("xp")
parms[0] = id
parms[1] = gPlayerXP[id]
set_task(5.0,"setXP",id,parms,2)
return true
}
dbi_free_result(retvalxp)
return true
}
This is the subroutine.
Code:
[OMGKEY->] STEAM_0:1:4050101
[OMGQUERY->] SELECT xp FROM uwc3_xp WHERE steamid='STEAM_0:1:4050101'
[OMGRETVAL->] 9
L 12/22/2004 - 02:19:21: [AMXX] Native error in "dbi_result" on line 77 (plugin "sl_uw_minlevel.amxx").
L 12/22/2004 - 02:19:21: [MySQL] Unknown error
L 12/22/2004 - 02:19:21: [AMXX] Debug Trace =>
L 12/22/2004 - 02:19:21: [AMXX] [0] Line 77, File "sl_uw_minlevel.sma"
L 12/22/2004 - 02:19:21: [AMXX] [1] Line 155, File "sl_uw_minlevel.sma"
[OMGSQLXP->] 0
is what I get no matter how much XP I have in that person's field.
Line 155 simply calls the CheckXP with the person's SteamID which you can see is not a problem.
I've tried dbi_field / dbi_result , not sure what is going on . Executing the supplied query on the database works though.
Any ideas?