MySQL Load Issue
#4

I don't know why are you making a loop as you're not even using it,

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;
}
and if it didn't work please show me how do you save cars.
Reply


Messages In This Thread
MySQL Load Issue - by RedCounty - 14.01.2015, 09:34
Re: MySQL Load Issue - by RedCounty - 14.01.2015, 19:41
Re: MySQL Load Issue - by Dignity - 14.01.2015, 19:44
Re: MySQL Load Issue - by xVIP3Rx - 14.01.2015, 20:06
Re: MySQL Load Issue - by RedCounty - 14.01.2015, 21:03

Forum Jump:


Users browsing this thread: 1 Guest(s)