12.04.2012, 23:48
Hey, I'm trying to load vehicles from SQL, but am having some difficulty.
I would just like to first say that I had vehicles loading fine before, using a for loop, though that was really slow and wasn't using SQL to it's full potential.
I've been looking for answers for quite some time now, but I couldn't find anything specific enough to help me out.
This returns
This returns on the mysql.log
under OnQueryFinish I got
I'm wanting to try without the e<>, though it is too long and I'm unsure of how to break it up. First time using sscanf as well as a while loop for SQL.
any help is greatly appreciated
.
I would just like to first say that I had vehicles loading fine before, using a for loop, though that was really slow and wasn't using SQL to it's full potential.
I've been looking for answers for quite some time now, but I couldn't find anything specific enough to help me out.
pawn Код:
format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM samp_vehicles");
mysql_query(sqlQuery, THREAD_LOADCARS);
Quote:
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 |
pawn Код:
format(sqlQuery, sizeof(sqlQuery), "SELECT * FROM 'samp_vehicles'");
mysql_query(sqlQuery, THREAD_LOADCARS);
Quote:
(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: |
pawn Код:
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();
any help is greatly appreciated
![Smiley](images/smilies/smile.png)