stock LoadOwnedCars(playerid)
{
new query[1024], savingstring[40], newcar, vID;
format(query, sizeof(query), "SELECT * FROM OwnedVehicles WHERE OwnedVehicleOwner = '%s'", pName(playerid));
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query,"|"))
{
mysql_fetch_field_row(savingstring, "OwnedVehicleID"); vID = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleModel"); Vehicles[vID][vModel] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleColor1"); Vehicles[vID][vColor1] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleColor2"); Vehicles[vID][vColor2] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehiclePrice"); Vehicles[vID][vPrice] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleX"); Vehicles[vID][vPosX] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleY"); Vehicles[vID][vPosY] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleZ"); Vehicles[vID][vPosZ] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleA"); Vehicles[vID][vPosA] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleOwner"); strmid(Vehicles[vID][VehicleOwner], savingstring, 0, strlen(savingstring), 24);
mysql_fetch_field_row(savingstring, "OwnedVehiclePlate"); strmid(Vehicles[vID][VehiclePlate], savingstring, 0, strlen(savingstring), 24);
mysql_fetch_field_row(savingstring, "OwnedVehiclePaintJob"); Vehicles[vID][VehiclePaintJob] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleLock"); Vehicles[vID][vLocked] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleMoney"); Vehicles[vID][vTrunkMoney] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleMaterials"); Vehicles[vID][vTrunkMats] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleCocaine"); Vehicles[vID][vTrunkCocaine] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleMoonshine"); Vehicles[vID][vTrunkMoonshine] = strval(savingstring);
mysql_fetch_field_row(savingstring, "OwnedVehicleFuel"); Vehicles[vID][vFuel] = strval(savingstring);
newcar = CreateVehicle(Vehicles[vID][vModel], Vehicles[vID][vPosX], Vehicles[vID][vPosY], Vehicles[vID][vPosZ], Vehicles[vID][vPosA], Vehicles[vID][vColor1], Vehicles[vID][vColor2], -1);
format(Vehicles[vID][VehicleOwner], 24, "%s", Vehicles[vID][VehicleOwner]);
format(Vehicles[vID][VehiclePlate], 32, "%s", Vehicles[vID][VehiclePlate]);
SetVehicleNumberPlate(newcar, Vehicles[vID][VehiclePlate]);
SetVehicleToRespawn(newcar);
OwnedCar(newcar) = vID;
}
mysql_free_result();
return 1;
}
[PHP] mysql_query("SELECT * FROM houses"); mysql_ store_result(); while(mysql_retrieve_row()) //this will be running until all rows are processed { //you can use mysql_fetch_field and mysql_fetch_field_row here } mysql_free_result(); [PHP] normaly ,it load the row 0 then row 1 and 2 .. |
OwnedCar(newcar) = vID;
hi before response I suggest you to use new version of mysql plugins : https://sampforum.blast.hk/showthread.php?tid=337810 , easier and faster than old version.
|
mysql_query("SELECT * FROM houses");
mysql_ store_result();
while(mysql_retrieve_row()) //this will be running until all rows are processed
{
//you can use mysql_fetch_field and mysql_fetch_field_row here
}
mysql_free_result();
I might just be tired and might not spot a (simple) mistake, but seriously, you have 1120 posts and run your own roleplay server (?). Learn to DEBUG your code.
1. See how many rows the script returns (printf("%d", mysql_num_rows())) after storing the result. 2. See what data is retrieved from each row (print retrieved data prior to the CreateVehicle line to determine and compare with the database to see if all data is retrieved correctly). 3. What kind a notation is the "OwnedCar(newcar) = vID;" line? Is it a function or a macro of some sort? If not then this must be something I've never seen before. 4. Print the newcar value. |
You know what, get off my post and I'll get other people that will be police to help me out. |