05.02.2017, 16:22
I just noticed that the cars are loading wrong
Code:
Example, I have a car that is type 1(for sale)
The plate is set right as it is saved in the database, but if I enter the car and use the debug command
It will tell me the right ID, that it is a type 3 vehicle which is DMV(wrong), and also it will tell me a DMV plate also DMV owner.
I also noticed that the car is misplaced with the first DMV car and the last SPAWN car is misplaced with this car.
Why is the data loading wrong?
Code:
PHP код:
LoadVehicleStats()
{
mysql_tquery(Database, "SELECT * FROM Vehicles LIMIT" #MAX_PVEHICLES, "OnVehiclesAvailable");
return 1;
}
public OnVehiclesAvailable()
{
for(new i = 0; i < MAX_PVEHICLES; i++)
{
cache_get_value_int(i, "ID", VehicleInfo[i][ID]);
cache_get_value(i, "Owner", VehicleInfo[i][vOwner], 24);
cache_get_value_int(i, "vModel", VehicleInfo[i][vModel]);
cache_get_value_float(i, "Pos_x", VehicleInfo[i][vPos_x]);
cache_get_value_float(i, "Pos_y", VehicleInfo[i][vPos_y]);
cache_get_value_float(i, "Pos_z", VehicleInfo[i][vPos_z]);
cache_get_value_float(i, "Rot", VehicleInfo[i][vRot]);
cache_get_value_int(i, "Fuel", VehicleInfo[i][vFuel]);
cache_get_value_int(i, "Type", VehicleInfo[i][vType]);
cache_get_value(i, "Plate", VehicleInfo[i][vPlate], 120);
cache_get_value_int(i, "vLock", VehicleInfo[i][vLock]);
cache_get_value_int(i, "Color1", VehicleInfo[i][vColor1]);
cache_get_value_int(i, "Color2", VehicleInfo[i][vColor2]);
cache_get_value_int(i, "RespawnDelay", VehicleInfo[i][vRespawnDelay]);
cache_get_value_int(i, "Price", VehicleInfo[i][vPrice]);
VehicleInfo[i][Vehicle_Cache] = cache_save();
pvehicle[VehicleInfo[i][ID]] = CreateVehicle(VehicleInfo[i][vModel], VehicleInfo[i][vPos_x], VehicleInfo[i][vPos_y], VehicleInfo[i][vPos_z], VehicleInfo[i][vRot], VehicleInfo[i][vColor1], VehicleInfo[i][vColor2], VehicleInfo[i][vRespawnDelay]);
SetVehicleNumberPlate(pvehicle[VehicleInfo[i][ID]], VehicleInfo[i][vPlate]);
}
return 1;
}
The plate is set right as it is saved in the database, but if I enter the car and use the debug command
PHP код:
CMD:testcar(playerid, params[])
{
new string[200], vid;
vid = GetPlayerVehicleID(playerid);
format(string, sizeof(string), "Vehicle ID: %d | Vehicle Type: %d, Plate: %s | Owner: %s", vid, VehicleInfo[vid][vType], VehicleInfo[vid][vPlate], VehicleInfo[vid][vOwner] );
SCM(playerid, COLOR_YELLOW, string);
return 1;
}
I also noticed that the car is misplaced with the first DMV car and the last SPAWN car is misplaced with this car.
Why is the data loading wrong?