AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Run time error 4: index out of bounds (https://forums.alliedmods.net/showthread.php?t=45502)

djh 10-04-2006 06:38

Run time error 4: index out of bounds
 
DEVS SHOULD REALLY LOOK INTO THIS -> see the 6'th reply
1'st of all. i know this happened before and i've read those posts, also i've searched google and what i found is that i should increase the max_admins to a higher value. i did. it didn't work
i also did this :
Code:
 #pragma dynamic 32768
i've seen that in the help file, to increase the memory. that didn't work also

the problem is as follows:

i have a mysql database (customised) -as in- it has the following design :
Code:

id - int Length(11) Primary key - auto increment
type - int length(11)
auth - varchar length(32) - ORIGINAL AMXX field
password - varchar length(32) - ORIGINAL AMXX field
access varchar length(32) - ORIGINAL AMXX field
flags varchar length(32) - ORIGINAL AMXX field
username varchar length(255)
email varchar length(64)
phone varchar length(64)
trust int length(11)
comments varchar length(255)

i have "admin_sql.amxx debug "(in the plugins.ini) and "mysql"(in the modules.ini) lines.
when i start up the server it all goes well except it gives me this message:
Code:


L 10/04/2006 - 13:30:23: -------- Mapchange to de_dust2 --------
Executing AMX Mod X Configuration File
Scrolling message displaying frequency: 10:00 minutes
L 10/04/2006 - 13:30:24: [AMXX] Displaying debug trace (plugin "admin_sql.amxx")
L 10/04/2006 - 13:30:24: [AMXX] Run time error 4: index out of bounds
L 10/04/2006 - 13:30:24: [AMXX]    [0] admin.sma::adminSql (line 465)

thanx for reading :) help please!

TheNewt 10-04-2006 11:19

Re: Run time error 4: index out of bounds
 
Would you post line 465? or the block of code around it.

Greenberet 10-04-2006 11:55

Re: Run time error 4: index out of bounds
 
Quote:

Originally Posted by MysticDeath (Post 387463)
Would you post line 465? or the block of code around it.

look in your scripting folder ;)
admin.sma

@djh
i think you have more then 64 admins. I dont see another case where this runtime error could happen.

so increase the MAX_ADMINS define on line 44 from 64 to eg. 128

djh 10-04-2006 11:58

Re: Run time error 4: index out of bounds
 
err. line 465 is blank.(w000t. now i'm seeing this)
here's the code around it:
Code:
460:        /** do this incase people change the query order and forget to modify below */ 461:        new qcolAuth = SQL_FieldNameToNum(query, "auth") 462:        new qcolPass = SQL_FieldNameToNum(query, "password") 463:        new qcolAccess = SQL_FieldNameToNum(query, "access") 464:        new qcolFlags = SQL_FieldNameToNum(query, "flags") 465:        466:        while (SQL_MoreResults(query)) 467:        { 468:            SQL_ReadResult(query, qcolAuth, g_aName[g_aNum], 31) 469:            SQL_ReadResult(query, qcolPass, g_aPassword[g_aNum], 31) 470:            SQL_ReadResult(query, qcolAccess, szAccess, 31) 471:            SQL_ReadResult(query, qcolFlags, szFlags, 31) 472:    473:            g_aAccess[g_aNum] = read_flags(szAccess) 474:    475:            g_aFlags[g_aNum] = read_flags(szFlags) 476:            477:            ++g_aNum 478:            SQL_NextRow(query) 479:        }

djh 10-04-2006 12:00

Re: Run time error 4: index out of bounds
 
greenberet as i said in the first post, i've been SEARCHING man :)
i know about the MAX_ADMINS and as i said in the first post i changed it to 128 even 256 and it doesn't work

djh 10-04-2006 12:43

Re: Run time error 4: index out of bounds
 
this is what devs should look into
ROFLZMAO this is really something.

ok i figured it out. pff.

so the amxx 1.76a (and previous versions - tho i might be wrong here) doesn't come with a .sma file for admin_sql. the only admin_sql file i got is admin_sql.amxx as in the already compiled plugin.
now, in the plugins.ini file you are instructed to comment the admin.amxx file and leave the admin_sql.amxx file only (if you want sql support, ofcourse). also in the modules.ini you must uncomment ";mysql".
that's exactly what i did.
then i populated the database and it got like 99 records, that's 99 admins

then i got the nasty out of bounds error and debugged almost a day to find out the problem. i must mention that i was only modifying the admin.sma file and recompiling. - because i have no admin_sql.sma to edit -
- because the admin_sql.amxx is compiled with MAX_ADMINS 64(i think this is right) the problem appears everytime and since the admin.amxx line in plugins.ini is commented, it didn't matter how many times i had to edit, recompile, restart the server, etc.
- now i don't know how admin.amxx and admin_sql.amxx interact but i suppose that whatever is declared in admin.amxx has priority, because once i uncommented the admin.amxx in the plugins.ini and left both admin.amxx and admin_sql.amxx running, it worked like a charm. with the exception that the output was doubled.
like this:
Code:

] restart
L 10/04/2006 - 19:47:13: -------- Mapchange to de_dust2 --------
Executing AMX Mod X Configuration File
Scrolling message displaying frequency: 10:00 minutes
[AMXX] Loaded 99 admins from database
Executing AMX Mod X Configuration File
Scrolling message displaying frequency: 10:00 minutes
[AMXX] Loaded 99 admins from database

at first the plugin appears to be loaded twice:
Code:

] amxx plugins
Currently loaded plugins:
      name                    version  author            file            status 
 [  1] Admin Base (SQL)        1.76    AMXX Dev Team    admin.amxx      running 
 [  2] Admin Base (SQL)        1.76    AMXX Dev Team    admin_sql.amxx  running

because certain things that i took for granted no longer applied, i thought `let's comment admin_sql.amxx back in the plugins.ini and see what happens`. and what happened is that it worked. (probably works in sql mode in a default install as long as you don't have mysql commented in the modules.ini)


so the final result is that i have a server running with admin_sql.amxx comented in plugins.ini and mysql uncommented in modules ini, also admin.amxx uncommented in the plugins.ini and finally admins loading from the mysql database.

VEN 10-04-2006 14:23

Re: Run time error 4: index out of bounds
 
I have no patience to get all what you said but i have a feeling that i can easily answer where is the problem.

The problem is that DEVs have forgot to remove the line
Quote:

;admin_sql.amxx ; admin base - SQL version (comment admin.amxx)
from the plugins.ini when they merged admin.sma and admin_sql.sma. I can't remember what is the first amxx version that includes combined admin.sma, but it was merged a long time ago.

So all what actually was necessary is uncommenting //#define USING_SQL in admin.sma and recompiling/reinstalling the plugin.

djh 10-05-2006 10:10

Re: Run time error 4: index out of bounds
 
you're correct VEN.
that must be what's going on.
nonetheless it's confusing for someone who wasn't around from the time they merged those.
i consider this issue solved ofc.
will a mod please lock this ? thank you :)
looking forward to see the new version of amxx with the default plugins.ini set right :) cheers


All times are GMT -4. The time now is 04:54.

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