Код:
public LoadDynamicVehicles()
{
new rows, fields;
new total = 0;
new id, model, color1, color2, faction, Float:x, Float:y, Float:z, Float:a, type, plate[128], info[128], vehicle;
cache_get_data(rows, fields);
if(rows)
{
while(total < rows)
{
id = cache_get_row_int(total, 0);
model = cache_get_row_int(total, 1);
color1 = cache_get_row_int(total, 2);
color2 = cache_get_row_int(total, 3);
x = cache_get_row_float(total, 4);
y = cache_get_row_float(total, 5);
z = cache_get_row_float(total, 6);
a = cache_get_row_float(total, 7);
type = cache_get_row_int(total, 8);
faction = cache_get_row_int(total, 9);
cache_get_row(total, 10, plate, dbHandle, 128);
cache_get_row(total, 11, info, dbHandle, 128);
vehicle = CreateVehicle(model, x, y, z, a, color1, color2, -1);
SetVehicleNumberPlate(vehicle, plate);
CityVehicles[vehicle][vVehicle] = vehicle;
CityVehicles[vehicle][vID] = id;
CityVehicles[vehicle][vModel] = model;
CityVehicles[vehicle][vColor1] = color1;
CityVehicles[vehicle][vColor2] = color2;
CityVehicles[vehicle][vPosX] = x;
CityVehicles[vehicle][vPosY] = y;
CityVehicles[vehicle][vPosZ] = z;
CityVehicles[vehicle][vPosA] = a;
CityVehicles[vehicle][vType] = type;
CityVehicles[vehicle][vFaction] = faction;
format(CityVehicles[vehicle][vPlate], 128, "%s", plate);
format(CityVehicles[vehicle][vInfo], 128, "%s", info);
CityVehicles[vehicle][vCarOn] = 1;
total++;
}
}
format(msg,sizeof(msg), "[MySQL]: Foram carregados %d veнculos dinвmicos da database.", total);
printf(msg);
return 1;
}