Error в загрузке организаций
#1

Всем доброго времени суток!

Не загружаются организации, не могу понять в чём дело

Загрузка:
PHP код:
mysql_tquery(dbHandle, "SELECT * FROM `fraction`",     "LoadFrac", ""); 
Сам паблик:
PHP код:
public LoadFrac()
{
    new 
time = GetTickCount(), rows, fields;
    
cache_get_data(rows, fields);
    if(
rows)
    {
        for(new 
idx = 1; idx <= rows; idx++)
        {
            
FracInfo[idx][fID] = cache_get_field_content_int(idx-1, "id", dbHandle);
            
cache_get_field_content(idx-1, "name", FracInfo[idx][fName], dbHandle, 32);
            
cache_get_field_content(idx-1, "leader", FracInfo[idx][fLeader], dbHandle, 32);
            
cache_get_field_content(idx-1, "assistant", FracInfo[idx][fAssistant], dbHandle, 32);
            
cache_get_field_content(idx-1, "helper", FracInfo[idx][fHelpers], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank1", FracRank[idx][1], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank2", FracRank[idx][2], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank3", FracRank[idx][3], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank4", FracRank[idx][4], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank5", FracRank[idx][5], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank6", FracRank[idx][6], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank7", FracRank[idx][7], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank8", FracRank[idx][8], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank9", FracRank[idx][9], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank10", FracRank[idx][10], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank11", FracRank[idx][11], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank12", FracRank[idx][12], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank13", FracRank[idx][13], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank14", FracRank[idx][14], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank15", FracRank[idx][15], dbHandle, 32);
            
cache_get_field_content(idx-1, "rank16", FracRank[idx][16], dbHandle, 32);
            
cache_get_field_content(idx-1, "payday", FracInfo[idx][fPayDays], dbHandle, 128);
            
sscanf(FracInfo[idx][fHelpers], "p<,>a<i>[5]", FracInfo[idx][fHelper]);
            
sscanf(FracInfo[idx][fPayDays], "p<,>iiiiiiiiiiiiiiii",
            
FracPay[idx][1], FracPay[idx][2], FracPay[idx][3], FracPay[idx][4], FracPay[idx][5], FracPay[idx][6], FracPay[idx][7],
            
FracPay[idx][8], FracPay[idx][9], FracPay[idx][10], FracPay[idx][11], FracPay[idx][12], FracPay[idx][13], FracPay[idx][14], FracPay[idx][15], FracPay[idx][16]);
            
TOTALFRAC++;
        }
    }
    
printf("[Загружено организаций]: <%i>. Потрачено: <%i ms>.", TOTALFRAC, GetTickCount() - time);
    return 
1;
} 
Ошибка:
PHP код:
[00:31:54] [debug] Run time error 4: "Array index out of bounds"
[00:31:54] [debug]  Accessing element at index 19 past array upper bound 18
[00:31:54] [debug] AMX backtrace:
[
00:31:54] [debug] #0 00185ed4 in public LoadFrac () at E:\Сервер\gamemodes\new.pwn:23223 
Reply
#2

Какое максимальное количество фракций указано в FracInfo?
Reply
#3

Quote:
Originally Posted by Stuntff
Посмотреть сообщение
Какое максимальное количество фракций указано в FracInfo?
Исправил. Поставил на один больше. То-есть значение 20, было 19. Но, в чём прикол то что организаций то всего 19 и если значение на 1 увеличиваю загружается нормально, но начинается проблема со скинами организаций.
Reply
#4

Проблема в цикле, который начинается от 1, так что до подставления от idx надо отнять 1.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)