14.04.2012, 03:33
(
Последний раз редактировалось DaRkM; 14.04.2012 в 04:44.
)
Alright it's working now, though only loading the first car in the DB, and for some reason the plate doesn't change(the second string).
EDIT: I also added another sscanf to set the carid array.
THREAD_LOADCARS was just being defined as "10" since OnQueryFinish was using Case.
EDIT2: Might as well show the enum.
EDIT3: Made a quick command to list the cInfo for car 1(the only car from the DB that spawns) and cPlate is returning nothing. Hmm
EDIT4: Took another look at the command results and everything after the first string, which is Owner, is incorrect.
EDIT5: Took yet another look, it is skipping cOwned, cPlate, cLock, cPaintjob, cVirWorld, cUnused. cComponent0 - cComponent13 is fine. Skips cCode, cTicketer, and sets cParkTicket to the integer in cUnused.
EDIT: I also added another sscanf to set the carid array.
pawn Код:
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();
EDIT2: Might as well show the enum.
pawn Код:
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];
EDIT4: Took another look at the command results and everything after the first string, which is Owner, is incorrect.
EDIT5: Took yet another look, it is skipping cOwned, cPlate, cLock, cPaintjob, cVirWorld, cUnused. cComponent0 - cComponent13 is fine. Skips cCode, cTicketer, and sets cParkTicket to the integer in cUnused.