12.11.2015, 12:44
I have the following code:
When it's called, it shows the following:
This is the database:
It's not loading anything, just showing that error.
pawn Код:
forward OnFCar_Load();
public OnFCar_Load(){
if(!cache_num_rows()) return printf("There are no faction cars to load.");
new rows, fields, vehicleid;
cache_get_data(rows, fields, sqlConnection);
for(new i = 0; i != cache_get_row_count(); i++)
{
vehicleid = CreateVehicle(FactionCars[i][fCarModel], FactionCars[i][fCarPos][1], FactionCars[i][fCarPos][2], FactionCars[i][fCarPos][3], FactionCars[i][fCarPos][4], FactionCars[i][fCarColor][1], FactionCars[i][fCarColor][2], -1);
FactionCars[vehicleid][fCarID] = cache_get_field_content_int(i, "ID", sqlConnection);
FactionCars[vehicleid][fCarModel] = cache_get_field_content_int(i, "Model", sqlConnection);
FactionCars[vehicleid][fCarLocked] = cache_get_field_content_int(i, "Locked", sqlConnection);
FactionCars[vehicleid][fCarFaction] = cache_get_field_content_int(i, "Faction", sqlConnection);
FactionCars[vehicleid][fCarInterior] = cache_get_field_content_int(i, "Interior", sqlConnection);
FactionCars[vehicleid][fCarWorld] = cache_get_field_content_int(i, "World", sqlConnection);
FactionCars[vehicleid][fCarColor][1] = cache_get_field_content_int(i, "C1", sqlConnection);
FactionCars[vehicleid][fCarColor][2] = cache_get_field_content_int(i, "C2", sqlConnection);
FactionCars[vehicleid][fCarPos][1] = cache_get_field_content_float(i, "X", sqlConnection);
FactionCars[vehicleid][fCarPos][2] = cache_get_field_content_float(i, "Y", sqlConnection);
FactionCars[vehicleid][fCarPos][3] = cache_get_field_content_float(i, "Z", sqlConnection);
FactionCars[vehicleid][fCarPos][4] = cache_get_field_content_float(i, "A", sqlConnection);
LinkVehicleToInterior(vehicleid, FactionCars[vehicleid][fCarInterior]);
SetVehicleVirtualWorld(vehicleid, FactionCars[vehicleid][fCarWorld]);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, engine, lights, alarm, FactionCars[vehicleid][fCarLocked], bonnet, boot, objective);
countFCars ++;
}
printf("%d faction cars loaded from the database.", countFCars);
return 1;
}
Код:
[13:42:10] R: 0 F: 0 [13:42:10] [debug] Run time error 4: "Array index out of bounds" [13:42:10] [debug] Accessing element at index 65535 past array upper bound 499 [13:42:10] [debug] AMX backtrace: [13:42:10] [debug] #0 0001db48 in public OnFCar_Load () from gm.amx
It's not loading anything, just showing that error.