30.05.2014, 21:31
Good evening people, I want to ask for help in loading vehicles from mysql script.
Here is my current script:
But it doesn't load any vehicles. maybe it's wrong with the i in brackets?
Here is my current script:
Код:
stock LoadVehiclesMySQL()
{
new Str[128], i = 1;
mysql_query("SELECT * FROM `vehicles`");
mysql_store_result();
if(mysql_num_rows() != 0)
{
while(mysql_fetch_row(Str))
{
sscanf(Str, "p<|>iffffiiis[32]s[32]ii", vInfo[i][Model], vInfo[i][vPosX], vInfo[i][vPosY], vInfo[i][vPosZ], vInfo[i][vPosA],
vInfo[i][vColor1], vInfo[i][vColor2], vInfo[i][Faction], vInfo[i][Plate], vInfo[i][Owner], vInfo[i][Paintjob], vInfo[i][Locked]);
CreateVehicle(vInfo[i][Model], vInfo[i][vPosX], vInfo[i][vPosY], vInfo[i][vPosZ], vInfo[i][vPosA], vInfo[i][vColor1], vInfo[i][vColor2], -1);
SetVehicleNumberPlate(i, vInfo[i][Plate]);
SetVehicleToRespawn(i);
i++;
}
}
mysql_free_result();
printf("--- %i vehicles loaded from the MySQL Database. ---", i);
return 1;
}

