27.05.2015, 19:09
hello
i have a problem of loading owned vehicles for players server load only car id 1 and don't load the other ids plz help
sorry for my bad english
i have a problem of loading owned vehicles for players server load only car id 1 and don't load the other ids plz help
pawn Код:
stock LoadOwnedVehicles()
{
new
Query[1024],
vModel2,
vC[2],
vPrice2,
vOwner2[MAX_PLAYER_NAME],
Float:Pos[4],
vID,
PlateNum[32],
vPaint_Job,
vLock,
vMoney,
vMats,
vCocaine,
vMoonshine,
vWeed,
CarFuel;
mysql_format(mysql, Query, sizeof(Query), "SELECT * FROM `OwnedVehicles` WHERE `OwnedVehicleID` < "#MAX_BUYABLE_VEH" ORDER BY OwnedVehicleID");
mysql_query(mysql, Query, "", "");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Query))
{
sscanf(Query, "p<|>iiiiis[24]ffffs[32]iiiiiiii",
vID, vModel2, vC[0], vC[1], vPrice2, vOwner2, Pos[0], Pos[1], Pos[2], Pos[3], PlateNum, vPaint_Job,
vLock, vMoney, vMats, vCocaine, vMoonshine, vWeed, CarFuel);
Vehicles[vID][vModel] = vModel2;
Vehicles[vID][vColor1] = vC[0];
Vehicles[vID][vColor2] = vC[1];
Vehicles[vID][vPrice] = vPrice2;
strmid(Vehicles[vID][VehicleOwner], vOwner2, 0, 24, 24);
Vehicles[vID][vPosX] = Pos[0];
Vehicles[vID][vPosY] = Pos[1];
Vehicles[vID][vPosZ] = Pos[2];
Vehicles[vID][vPosA] = Pos[3];
strmid(Vehicles[vID][VehiclePlate], PlateNum, 0, 32, 32);
Vehicles[vID][VehiclePaintJob] = vPaint_Job;
Vehicles[vID][vLocked] = vLock;
Vehicles[vID][vTrunkMoney] = vMoney;
Vehicles[vID][vTrunkMats] = vMats;
Vehicles[vID][vTrunkCocaine] = vCocaine;
Vehicles[vID][vTrunkWeed] = vWeed;
Vehicles[vID][vTrunkMoonshine] = vMoonshine;
Vehicles[vID][vFuel] = CarFuel;
if(Vehicles[vID][vLocked] == 1)
{
SetVehicleParamsEx(vID, 0, 0, 0, 1, 0, 0, 0);
}
new
vCarID = CreateVehicle(Vehicles[vID][vModel], Vehicles[vID][vPosX], Vehicles[vID][vPosY], Vehicles[vID][vPosZ], Vehicles[vID][vPosA], Vehicles[vID][vColor1], Vehicles[vID][vColor2], 500000);
ChangeVehicleColor(vCarID, Vehicles[vID][vColor1], Vehicles[vID][vColor2]);
OwnedCar(vCarID) = vID;
format(Vehicles[OwnedCar(vCarID)][VehiclePlate], 10, "%s", Vehicles[OwnedCar(vCarID)][VehiclePlate]);
SetVehicleNumberPlate(vCarID, Vehicles[OwnedCar(vCarID)][VehiclePlate]);
SetVehicleToRespawn(OwnedCar(vCarID));
++ TotalVehiclesCreated;
SaveOwnedCar(OwnedCar(vCarID));
printf("OC: %s spawned - Plate: %s.", GetVehicleName(vCarID), Vehicles[OwnedCar(vCarID)][VehiclePlate]);
}
}
mysql_free_result();
printf("%d owned vehicles loaded from the MySQL Database.", TotalVehiclesCreated);
return TotalVehiclesCreated;
}
sorry for my bad english