SQL Loading./
#1

I have the code below, but when I use it and call that function, it only loads one vehicle.. Where as it's supposed to load 3 vehicles or however many the player has got?

Could someone help please?

Here's the code:

pawn Код:
stock LoadOwnedCars(playerid)
{
    new query[1024], savingstring[40], newcar, vID;
    format(query, sizeof(query), "SELECT * FROM OwnedVehicles WHERE OwnedVehicleOwner = '%s'", pName(playerid));
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(savingstring, "OwnedVehicleID"); vID = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleModel"); Vehicles[vID][vModel] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleColor1"); Vehicles[vID][vColor1] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleColor2"); Vehicles[vID][vColor2] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehiclePrice"); Vehicles[vID][vPrice] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleX"); Vehicles[vID][vPosX] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleY"); Vehicles[vID][vPosY] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleZ"); Vehicles[vID][vPosZ] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleA"); Vehicles[vID][vPosA] = floatstr(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleOwner"); strmid(Vehicles[vID][VehicleOwner], savingstring, 0, strlen(savingstring), 24);
        mysql_fetch_field_row(savingstring, "OwnedVehiclePlate"); strmid(Vehicles[vID][VehiclePlate], savingstring, 0, strlen(savingstring), 24);
        mysql_fetch_field_row(savingstring, "OwnedVehiclePaintJob"); Vehicles[vID][VehiclePaintJob] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleLock"); Vehicles[vID][vLocked] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleMoney"); Vehicles[vID][vTrunkMoney] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleMaterials"); Vehicles[vID][vTrunkMats] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleCocaine"); Vehicles[vID][vTrunkCocaine] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleMoonshine"); Vehicles[vID][vTrunkMoonshine] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "OwnedVehicleFuel"); Vehicles[vID][vFuel] = strval(savingstring);
        newcar = CreateVehicle(Vehicles[vID][vModel], Vehicles[vID][vPosX], Vehicles[vID][vPosY], Vehicles[vID][vPosZ], Vehicles[vID][vPosA], Vehicles[vID][vColor1], Vehicles[vID][vColor2], -1);
        format(Vehicles[vID][VehicleOwner], 24, "%s", Vehicles[vID][VehicleOwner]);
        format(Vehicles[vID][VehiclePlate], 32, "%s", Vehicles[vID][VehiclePlate]);
        SetVehicleNumberPlate(newcar, Vehicles[vID][VehiclePlate]);
        SetVehicleToRespawn(newcar);
        OwnedCar(newcar) = vID;
    }
    mysql_free_result();
    return 1;
}
Thanks!
Reply


Messages In This Thread
SQL Loading./ - by iGetty - 18.06.2012, 01:08
Re: SQL Loading./ - by SuperViper - 18.06.2012, 02:11
Re: SQL Loading./ - by iGetty - 18.06.2012, 20:22
Re: SQL Loading./ - by iGetty - 24.06.2012, 16:50

Forum Jump:


Users browsing this thread: 1 Guest(s)