AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SQL Failure, not sure why (https://forums.alliedmods.net/showthread.php?t=8688)

Saturn SL1-WNY 12-22-2004 02:18

SQL Failure, not sure why
 
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?

XxAvalanchexX 12-22-2004 03:18

Re: SQL Failure, not sure why
 
Quote:

Originally Posted by Saturn SL1-WNY
the Ultimate Warcraft3 Plugin. The guy hasn't released the source

Legally, he has to. :-)

mobytoss 12-22-2004 05:17

Does he *have* to as in, everything he creates, has to be uploaded or whatever, 'cause that's a bit extreme. I thought it was more a case of not purposefully restricting code and ideas to stop others using them.

With the SQL, I dont see what's not happening. What exactly is the error? Is it compiling without any complaints?

Saturn SL1-WNY 12-22-2004 14:06

Yeah I got it to go I forgot dbi_nextrow

However I keep getting
[OMGSQLXP->] 50 2604010
as the result. Where is this other number coming from in front?

str_to_num fails it then because it can't convert that and I end up with
junk like :


[OMGGPLAYERXP->] ê

twistedeuphoria 12-22-2004 15:08

What is on line 77?


All times are GMT -4. The time now is 19:15.

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