SA-MP Forums Archive
MYSQL Select question - 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: MYSQL Select question (/showthread.php?tid=490892)



MYSQL Select question - Stefand - 28.01.2014

Hello,

How can I change this code:

pawn Код:
stock InitVehicles()
{
    new query[400];
    for(new id; id < MAX_SERVERVEHICLES; id++) // Goes through all the slots, looking for the data
    {
        format(query, sizeof(query), "SELECT * FROM `Vehicles` WHERE `VehicleID` = %d", id); // Selects all the information from the table
        mysql_function_query(g_connectionHandle, query, true, "LoadVehiclesCallback", "d", id);
    }
    return 1;
}
So it can load all the data from that Vehicles table, and continue to load the cars, because if:

I have these cars:

1,2,3,4,5,6,7,8,9,10

And I delete car 5, then the script still checks car 5 and the Auto_Increment value would never set slot 5 again so it would make 11 instead.

so if I set my MAX_SERVERVEHICLES to 1000 and I deleted 1000 cars and save another 1000 then it does not spawn anything anymore.. (atleast thats my logic..)