14.01.2015, 20:06
I don't know why are you making a loop as you're not even using it,
try this
and if it didn't work please show me how do you save cars.
try this
pawn Код:
forward loadPlayerVehiclesSQL(playerid);
public loadPlayerVehiclesSQL(playerid)
{
new rows, fields, vehicleid=-1;
cache_get_data(rows, fields, sqlConnection);
for(new i; i < rows; i++)
{
vehicleid = CreateVehicle(cache_get_field_content_int(i, "Model", sqlConnection), cache_get_field_content_float(i, "X", sqlConnection), cache_get_field_content_float(i, "Y", sqlConnection), cache_get_field_content_float(i, "Z", sqlConnection), cache_get_field_content_float(i, "A", sqlConnection), cache_get_field_content_int(i, "Color1", sqlConnection), cache_get_field_content_int(i, "Color2", sqlConnection), -1);
PlayerVehicles[vehicleid][pVehicleID] = cache_get_field_content_int(i, "ID", sqlConnection);
PlayerVehicles[vehicleid][pVehicleModel] = cache_get_field_content_int(i, "Model", sqlConnection);
cache_get_field_content(i, "Owner", PlayerVehicles[vehicleid][pVehicleOwner], sqlConnection, 24);
cache_get_field_content(i, "Plate", PlayerVehicles[vehicleid][pVehiclePlate], sqlConnection, 10);
PlayerVehicles[vehicleid][pVehicleColor][1] = cache_get_field_content_int(i, "Color1", sqlConnection);
PlayerVehicles[vehicleid][pVehicleColor][2] = cache_get_field_content_int(i, "Color2", sqlConnection);
PlayerVehicles[vehicleid][pVehiclePos][1] = cache_get_field_content_float(i, "X", sqlConnection);
PlayerVehicles[vehicleid][pVehiclePos][2] = cache_get_field_content_float(i, "Y", sqlConnection);
PlayerVehicles[vehicleid][pVehiclePos][3] = cache_get_field_content_float(i, "Z", sqlConnection);
PlayerVehicles[vehicleid][pVehiclePos][4] = cache_get_field_content_float(i, "A", sqlConnection);
SetVehicleNumberPlate(vehicleid, PlayerVehicles[vehicleid][pVehiclePlate]);
SetVehicleToRespawn(vehicleid);
ChangeVehiclePaintjob(vehicleid, 3);
ChangeVehicleColor(vehicleid, PlayerVehicles[vehicleid][pVehicleColor][1], PlayerVehicles[vehicleid][pVehicleColor][2]);
printf("Vehicle %s loaded (%d) from the database.", GetVehicleName(vehicleid), PlayerVehicles[vehicleid][pVehicleID]);
}
return 1;
}