29.04.2015, 19:18
well,here is what happens when i save :
runtime error:
NOTE:Lets say there was 5 created ID's and were saved,it shows at index 6 bound 5,always like that
when i removed this it worked without runtime error
pawn Код:
//under ongamemode exit.
for(new i = 0; i < MAX_IDS; i++)
{
if(idinfo[i][use] == 1)
{
SaveID(i);
}
}
pawn Код:
public SaveID(id)
{
if(idinfo[i][use] == 1)
{
for(new i = 0; i < 10; i++)
{
if(numberidinfo[id][used] == 1)
{
new query[700];
mysql_format(dbHandle,query, sizeof(query), "UPDATE `id` SET `iduse`=%d,`idid`=%d,`idkind`=%d,`iddo`=%d,`idpx`=%f,`idpy`=%f,`idpz`=%f,`idrx`=%f,`idry`=%f,`idrz`='%f',`idin`=%d,`idvw`=%d WHERE `idnum`=%d AND `id`=%d",
idinfo[id][IDUSE][i], idinfo[id][IDID][i], idinfo[id][IDKIND][i], idinfo[id][IDDO][i], idinfo[id][IDPX][i],
idinfo[id][IDPY][i], idinfo[id][IDPZ][i], idinfo[id][IDRX][i], idinfo[id][IDRY][i], idinfo[id][IDRZ][i]
,idinfo[id][IDIN][i], idinfo[id][IDVW][i], id, i);
printf("\n %s", query);
mysql_tquery(mysql, query, "", "");
printf("Saved ID %d", id);
printf("%d updated", i);
}
}
}
return 1;
}
Код:
[debug] Run time error 4: "Array index out of bounds" [debug] Accessing element at index 10 past array upper bound 9 [debug] AMX backtrace: [debug] #0 00024134 in ?? () from gm.amx [debug] #1 0000c81c in ?? () from gm.amx [debug] #2 00009f6c in public OnGameModeExit () from gm.amx
when i removed this it worked without runtime error