Vehicle loading problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle loading problem (
/showthread.php?tid=579325)
Vehicle loading problem -
McGuiness - 26.06.2015
Hi,
I made the vehicle system for factions but the problem is that the vehicles won't load, they save perfectly but the loading part it doesn't, here is the code:
pawn Код:
stock LoadVehicles()
{
new string[128];
new VehicleID, VehicleModel, Float:VehicleX, Float:VehicleY, Float:VehicleZ, Float:VehicleA, Col1, Col2, Fac, i = 0;
mysql_query("SELECT * FROM `vehicledata`");
mysql_store_result();
if(mysql_num_rows() != 0)
{
while(mysql_fetch_row(string))
{
sscanf(string, "p<|>ddffffddd", VehicleID, VehicleModel, VehicleX, VehicleY, VehicleZ, VehicleA, Col1, Col2, Fac);
CreateVehicle(VehicleModel, VehicleX, VehicleY, VehicleZ, VehicleA, Col1, Col2, 900000000000, 1);
vInfo[i][Faction] = Fac;
vInfo[i][Owned] = 0;
vInfo[i][VehID] = VehicleID;
i++;
}
}
mysql_free_result();
printf("--- %i vehicles loaded from the database. ---");
return 1;
}
Re: Vehicle loading problem -
Inn0cent - 26.06.2015
Код:
stock LoadVehicles()
{
new string[128];
new VehicleID, VehicleModel, Float:VehicleX, Float:VehicleY, Float:VehicleZ, Float:VehicleA, Col1, Col2, Fac, i = 0;
new Query = mysql_query("SELECT * FROM `vehicledata`");
mysql_store_result();
if(mysql_num_rows() != 0)
{
while(mysql_fetch_row_format(Query, "|"))
{
mysql_fetch_field_row(i, "Column Name");
Variable = strval(i);
And So on..
CreateVehicle(VehicleModel, VehicleX, VehicleY, VehicleZ, VehicleA, Col1, Col2, 900000000000, 1);
vInfo[i][Faction] = Fac;
vInfo[i][Owned] = 0;
vInfo[i][VehID] = VehicleID;
i++;
}
}
mysql_free_result();
printf("--- %i vehicles loaded from the database. ---");
return 1;
}
Try this, Anyway use the updated MySQL version, Its out of date now.