01.01.2014, 17:36
So, I got this stock function which will load cars, and if the vehicle belongs to a faction, it will spawn it.
The complie gives 0 errors but when I start it up, it wont spawn vehicles, I have checked that the stock works and it gets the correct values.
The complie gives 0 errors but when I start it up, it wont spawn vehicles, I have checked that the stock works and it gets the correct values.
pawn Код:
stock SpawnVehicles()
{
new query[1500];
print("Started vehicle loading!");
for(new id; id < MAX_CARS; id++)
{
format(query, sizeof(query), "SELECT vModel, vCol1, vCol2, vOwner, vPlate, vPosX, vPosY, vPosZ, Faction FROM vehicles WHERE SQLID = '%d'", id);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
if(mysql_fetch_row_format(query, "|"))
{
sscanf(query,"p<|>ddds[64]s[32]fffd",
VehicleInfo[id][vModel],
VehicleInfo[id][vCol1],
VehicleInfo[id][vCol2],
VehicleInfo[id][vOwner],
VehicleInfo[id][vPlate],
VehicleInfo[id][vPosX],
VehicleInfo[id][vPosY],
VehicleInfo[id][vPosZ],
VehicleInfo[id][Faction]);
Total_Vehicles_Created++;
}
if(VehicleInfo[id][Faction] > 0)
{
VehicleInfo[id][vID] = CreateVehicle(VehicleInfo[id][vModel], VehicleInfo[id][vPosX], VehicleInfo[id][vPosY], VehicleInfo[id][vPosZ], 0, VehicleInfo[id][vCol1], VehicleInfo[id][vCol2], 1);
}
}
mysql_free_result();
printf("> %d Vehicles have been loaded from the database", Total_Vehicles_Created);
return 1;
}