SA-MP Forums Archive
Why Won't This Load From A Database? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why Won't This Load From A Database? (/showthread.php?tid=540070)



Why Won't This Load From A Database? - Ox1gEN - 02.10.2014

So, I'm trying to load vehicles from a database, well, that isn't working.

Code:

pawn Код:
stock MySQL_LOADvehicles()
{
    new query[30];
    mysql_format(g_Read, query, sizeof(query), "SELECT * FROM vehicles");
    mysql_pquery(g_Read, query, "OnVehicleLoad");
}


forward OnVehicleLoad();
public OnVehicleLoad()
{
    for(new i = 0; i < _:Vehicles ; i++)
    {
        VehInfo[i][VehicleID] = cache_get_field_content_int(i, "VehicleID");
        VehInfo[i][RentCash] = cache_get_field_content_int(i, "RentCash");
        VehInfo[i][Col1] = cache_get_field_content_int(i, "Col1");
        VehInfo[i][Col2] = cache_get_field_content_int(i, "Col2");
        VehInfo[i][Model] = cache_get_field_content_int(i, "Model");
        VehInfo[i][PosX] = cache_get_field_content_float(i, "PosX");
        VehInfo[i][PosY] = cache_get_field_content_float(i, "PosY");
        VehInfo[i][PosZ] = cache_get_field_content_float(i, "PosZ");
        VehInfo[i][RotZ] = cache_get_field_content_float(i, "RotZ");

        VehInfo[i][RentAvailable] = CreateVehicle(VehInfo[i][Model], VehInfo[i][PosX], VehInfo[i][PosY], VehInfo[i][PosZ], VehInfo[i][RotZ], VehInfo[i][Col1], VehInfo[i][Col2], -1);
    }
}



Re: Why Won't This Load From A Database? - Ox1gEN - 03.10.2014

Some help would be appreciated.


Re: Why Won't This Load From A Database? - YanLanger - 03.10.2014

What does it do ? just nothing ?


Re: Why Won't This Load From A Database? - Ox1gEN - 03.10.2014

Nothing.

Like I assume it caches everything, it just doesn't create the vehicles, maybe I got the loop the wrong way?