MySQL Load Issue
#1

I have this code:

pawn Код:
forward loadPlayerVehiclesSQL(playerid);
public loadPlayerVehiclesSQL(playerid)
{
    new rows, fields, vehicleid=-1;
   
    cache_get_data(rows, fields, sqlConnection);
   
    for(new i = 0; i < rows && i < 3; i++)
    {
        vehicleid = CreateVehicle(cache_get_field_content_int(0, "Model", sqlConnection), cache_get_field_content_float(0, "X", sqlConnection), cache_get_field_content_float(0, "Y", sqlConnection), cache_get_field_content_float(0, "Z", sqlConnection), cache_get_field_content_float(0, "A", sqlConnection), cache_get_field_content_int(0, "Color1", sqlConnection), cache_get_field_content_int(0, "Color2", sqlConnection), -1);

        PlayerVehicles[vehicleid][pVehicleID] = cache_get_field_content_int(0, "ID", sqlConnection);
        PlayerVehicles[vehicleid][pVehicleModel] = cache_get_field_content_int(0, "Model", sqlConnection);

        cache_get_field_content(0, "Owner", PlayerVehicles[vehicleid][pVehicleOwner], sqlConnection, 24);

        PlayerVehicles[vehicleid][pVehicleColor][1] = cache_get_field_content_int(0, "Color1", sqlConnection);
        PlayerVehicles[vehicleid][pVehicleColor][2] = cache_get_field_content_int(0, "Color2", sqlConnection);

        PlayerVehicles[vehicleid][pVehiclePos][1] = cache_get_field_content_float(0, "X", sqlConnection);
        PlayerVehicles[vehicleid][pVehiclePos][2] = cache_get_field_content_float(0, "Y", sqlConnection);
        PlayerVehicles[vehicleid][pVehiclePos][3] = cache_get_field_content_float(0, "Z", sqlConnection);
        PlayerVehicles[vehicleid][pVehiclePos][4] = cache_get_field_content_float(0, "A", sqlConnection);

        cache_get_field_content(0, "Plate", PlayerVehicles[vehicleid][pVehiclePlate], sqlConnection, 10);

        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;
}
It loads the vehicles just right, well - kind of right. It only loads 1, two times.

I have two vehicles in the database (`playervehicles`) table, one which is an Infernus (ID 400) and one which is a Landstalker (ID 401), it's currently loading the Landstalker two times and not touching the Infernus at all.


The system is designed to call upon a player logging in, which would ensure that the vehicles aren't being flooded at all times. Meaning, once logged in - this SQL is called and the vehicles which have the owner of my name are being loaded, then upon logging out, they're destroying. The whole thing is working perfectly, apart from the loading sector of it which is only loading one model, twice.

Any help is appreciated.
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)