26.05.2011, 19:55
I am sorry for all of this, but I am having trouble with my vehicle loading code AGAIN..
Here is the code for the loading:
And here is my server log:
As you can see it says "null" which I have no idea why, I have used this vehicle system before on another script but it just doesn't want to work any more.
~ Regards, Luis.
Here is the code for the loading:
pawn Код:
forward LoadVehicles();
public LoadVehicles()
{
new query[128], line[512], placeholder;
for(cars = 1; cars <= MAX_CARS; cars++) {
format(query, sizeof(query), "SELECT * FROM vehicles WHERE `ID` = %d", cars);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 1) {
cars--;
return 1;
}
mysql_free_result();
mysql_fetch_row(line);
sscanf(line, "p|ddffffdd", placeholder, VehicleInfo[cars][vModel], VehicleInfo[cars][vPosX], VehicleInfo[cars][vPosY], VehicleInfo[cars][vPosZ], VehicleInfo[cars][vPosA], VehicleInfo[cars][vCol1], VehicleInfo[cars][vCol2]);
printf("DEBUG: %d Vehicles Loaded.", cars);
print(line);
CreateVehicle(VehicleInfo[cars][vModel], VehicleInfo[cars][vPosX], VehicleInfo[cars][vPosY], VehicleInfo[cars][vPosZ], VehicleInfo[cars][vPosA], VehicleInfo[cars][vCol1], VehicleInfo[cars][vCol2], 0);
}
return 1;
}
Код:
[20:57:22] DEBUG: 1 Vehicles Loaded. [20:57:22] (null) [20:57:22] DEBUG: 2 Vehicles Loaded. [20:57:22] (null) [20:57:22]
~ Regards, Luis.