format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM samp_vehicles");
mysql_query(sqlQuery, THREAD_LOADCARS);
Runtime Error 4: "Array index out of bounds" Accessing element at negative index -1 Backtrace (most recent call first): #0 public OnQueryFinish()+0x36beac from gm.amx |
format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM 'samp_vehicles'");
mysql_query(sqlQuery, THREAD_LOADCARS);
(12/4/2012)[16:51:7] error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''samp_vehicles'' at line 1 | query: |
mysql_store_result();
new row[4000];
while(mysql_fetch_row(row))
{
sscanf(row, "p<|>e<ddffffdds[64]ds[20]ddddddddddddddddddds[64]d>", CarInfo[extraid]);
ownedcar[extraid] = AddStaticVehicle(CarInfo[extraid][cModel],CarInfo[extraid][cLocationx],CarInfo[extraid][cLocationy],CarInfo[extraid][cLocationz], CarInfo[extraid][cColorOne], CarInfo[extraid][cColorTwo],100);
if(CarInfo[extraid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(extraid, CarInfo[extraid][cPaintjob]);
}
SetVehicleVirtualWorld(extraid, CarInfo[extraid][cVirWorld]);
SetVehicleNumberPlate(extraid, CarInfo[extraid][cPlate]);
SetVehicleModifications(extraid);
}
mysql_free_result();
mysql_store_result();
new row[4000];
while(mysql_fetch_row(row))
{
sscanf(row, "p<|>e<ddffffdds[64]ds[20]ddddddddddddddddddds[64]d>", CarInfo[extraid]);
ownedcar[extraid] = AddStaticVehicle(CarInfo[extraid][cModel],CarInfo[extraid][cLocationx],CarInfo[extraid][cLocationy],CarInfo[extraid][cLocationz], CarInfo[extraid][cColorOne], CarInfo[extraid][cColorTwo],100);
if(CarInfo[extraid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(extraid, CarInfo[extraid][cPaintjob]);
}
SetVehicleVirtualWorld(extraid, CarInfo[extraid][cVirWorld]);
SetVehicleNumberPlate(extraid, CarInfo[extraid][cPlate]);
SetVehicleModifications(extraid);
}
mysql_free_result();
format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM samp_vehicles");
mysql_query(sqlQuery, THREAD_LOADCARS);
new sqlQuery[164];
format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM samp_vehicles");
mysql_query(sqlQuery);
mysql_store_result();
new row[4000], carid;
while(mysql_fetch_row(row))
{
sscanf(row, "p<|>d",carid);
sscanf(row, "p<|>e<ddffffdds[64]ds[16]ddddddddddddddddddds[64]d>", CarInfo[carid]);
ownedcar[carid] = AddStaticVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz], CarInfo[carid][cColorOne], CarInfo[carid][cColorTwo],100);
if(CarInfo[carid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
SetVehicleNumberPlate(carid, CarInfo[carid][cPlate]);
SetVehicleModifications(carid);
}
mysql_free_result();
enum cInfo
{
cID,
cModel,
Float:cLocationx,
Float:cLocationy,
Float:cLocationz,
Float:cAngle,
cColorOne,
cColorTwo,
cOwner[MAX_PLAYER_NAME],
cOwned,
cPlate[15],
cLock,
cPaintjob,
cVirWorld,
cUnused,
cComponent0,
cComponent1,
cComponent2,
cComponent3,
cComponent4,
cComponent5,
cComponent6,
cComponent7,
cComponent8,
cComponent9,
cComponent10,
cComponent11,
cComponent12,
cComponent13,
cCode,
cTicketer[MAX_PLAYER_NAME],
cParkTicket
};
new CarInfo[MAX_VEHICLES][cInfo];
sscanf(row, "p<|>d",carid);
mysql_query("SELECT * FROM samp_vehicles");
mysql_store_result();
new row[4000], carid;
while(mysql_fetch_row(row))
{
carid ++;
sscanf(row, "p<|>e<ddffffdds[64]ds[16]ddddddddddddddddddds[64]d>", CarInfo[carid]);
ownedcar[carid] = AddStaticVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz], CarInfo[carid][cColorOne], CarInfo[carid][cColorTwo],100);
if(CarInfo[carid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
SetVehicleNumberPlate(carid, CarInfo[carid][cPlate]);
SetVehicleModifications(carid);
}
mysql_free_result();
mysql_query("SELECT * FROM samp_vehicles");
mysql_store_result();
new row[4000], carid;
while(mysql_retrieve_row())
{
mysql_fetch_row(row);
carid ++;
sscanf(row, "p<|>e<ddffffdds[64]ds[16]ddddddddddddddddddds[64]d>", CarInfo[carid]);
ownedcar[carid] = AddStaticVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz], CarInfo[carid][cColorOne], CarInfo[carid][cColorTwo],100);
if(CarInfo[carid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
SetVehicleNumberPlate(carid, CarInfo[carid][cPlate]);
SetVehicleModifications(carid);
}
mysql_free_result();
print(row);
Still skipping those variables listed above as well. Also seems to be setting those fields in the DB that are being skipped to 0/blank the first time. I noticed it did that for the first car before, so I manually changed the fields in the DB back to what they were before and then restarted the server. It didn't change them back to 0/blank, but it didn't load them still. It's now doing that for this second car that has now loaded. I'm so confused. |