SA-MP Forums Archive
How can fix This - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How can fix This (/showthread.php?tid=580312)



How can fix This - keyvanik - 04.07.2015

PHP код:
[11:32:30] [debugRun time error 4"Array index out of bounds"
[11:32:30] [debug]  Accessing element at index 30 past array upper bound 29
[11:32:30] [debugAMX backtrace:
[
11:32:30] [debug#0 0008e334 in public OnTurfsLoad () from gm.amx
[11:32:31] [debugRun time error 4"Array index out of bounds"
[11:32:31] [debug]  Accessing element at index 30 past array upper bound 29
[11:32:31] [debugAMX backtrace:
[
11:32:31] [debug#0 00081040 in public SetPlayerUnjail () from gm.amx
[11:32:32] [debugRun time error 4"Array index out of bounds"
[11:32:32] [debug]  Accessing element at index 30 past array upper bound 29
[11:32:32] [debugAMX backtrace
this is my OnTurfsLoad

PHP код:
public LoadTurfs()
{
    print(
"\nLoading Turfs ...\n");
    
mysql_function_query(handle,"SELECT * FROM `turfs`",true,"OnTurfsLoad","");
    return 
1;
}
forward OnTurfsLoad();
public 
OnTurfsLoad()
{
for(new 
0;i<cache_get_row_count(handle);i++)
{
TurfInfo[i][zSQLid] = i;
cache_get_row(i,1,TurfInfo[i][zOwner],handle,64);
TurfInfo[i][zMinX] = cache_get_row_float(i,2,handle);
TurfInfo[i][zMinY] = cache_get_row_float(i,3,handle);
TurfInfo[i][zMaxX] = cache_get_row_float(i,4,handle);
TurfInfo[i][zMaxY] = cache_get_row_float(i,5,handle);
}
    for(new 
0sizeof(TurfInfo); i++)
    {
        
Turfs[i] = GangZoneCreate(TurfInfo[i][zMinX],TurfInfo[i][zMinY],TurfInfo[i][zMaxX],TurfInfo[i][zMaxY]);
        
turfattacker[i] = 9999;
        
turfkhod[i] = 9999;
        
killsattackerturf[i] = 0;
        
deathsattackerturf[i] = 0;
        
killskhodturf[i] = 0;
        
deathskhodturf[i] = 0;
        
scoreattacker[i] = 0;
        
scorekhod[i] = 0;
        
TurfTime[i] = 0;
        
TurfReload[i] = 0;
    }
print(
"\nAll Turfs Loaded.\n");
return 
1;




Re: How can fix This - prineside - 04.07.2015

What is the size of TurfInfo? Looks like there are more than 30 rows in database and you are trying to load them into small array.