03.10.2014, 13:20
So bassicly this is a follow-up thread to a thread I posted yesterday and I'd like to know for example, how to load stuff using a loop, so like it'll load alot of stuff at once, for example: pickups, vehicles, and more.
Here's just a simple code I've attempted to do so yet I don't know how, I'd like someone to fix it and explain to me what he did and how is it supposed to work.
Here's just a simple code I've attempted to do so yet I don't know how, I'd like someone to fix it and explain to me what he did and how is it supposed to work.
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);
}
}