aavm156
Дебютант
stock LoadOrders()
{
new Cache: result, rows;
result = mysql_query(mysql, "SELECT * FROM orders");
rows = cache_num_rows();
if(rows > sizeof g_order)
rows = sizeof g_order;
new buffer;
for(new idx; idx < rows; idx ++)
{
SetOrderData(idx, O_SQL_ID, cache_get_value_index_int(idx, 0));
SetOrderData(idx, O_TYPE, cache_get_value_index_int(idx, 1));
SetOrderData(idx, O_COMPANY_ID, cache_get_value_index_int(idx, 2));
SetOrderData(idx, O_AMOUNT, cache_get_value_index_int(idx, 3));
SetOrderData(idx, O_PRICE, cache_get_value_index_int(idx, 4));
SetOrderData(idx, O_TIME, cache_get_value_index_int(idx, 5));
SetOrderData(idx, O_USED, false);
buffer = GetOrderData(idx, O_COMPANY_ID);
switch(GetOrderData(idx, O_TYPE))
{
case ORDER_TYPE_FUEL_STATION:
{
SetFuelStationData(buffer, FS_ORDER_ID, idx);
}
case ORDER_TYPE_BUSINESS:
{
SetBusinessData(buffer, B_ORDER_ID, idx);
}
}
}
cache_delete(result);
printf("[Orders]: Çàêàçîâ çàãðóæåíî: %d", rows);
}
{
new Cache: result, rows;
result = mysql_query(mysql, "SELECT * FROM orders");
rows = cache_num_rows();
if(rows > sizeof g_order)
rows = sizeof g_order;
new buffer;
for(new idx; idx < rows; idx ++)
{
SetOrderData(idx, O_SQL_ID, cache_get_value_index_int(idx, 0));
SetOrderData(idx, O_TYPE, cache_get_value_index_int(idx, 1));
SetOrderData(idx, O_COMPANY_ID, cache_get_value_index_int(idx, 2));
SetOrderData(idx, O_AMOUNT, cache_get_value_index_int(idx, 3));
SetOrderData(idx, O_PRICE, cache_get_value_index_int(idx, 4));
SetOrderData(idx, O_TIME, cache_get_value_index_int(idx, 5));
SetOrderData(idx, O_USED, false);
buffer = GetOrderData(idx, O_COMPANY_ID);
switch(GetOrderData(idx, O_TYPE))
{
case ORDER_TYPE_FUEL_STATION:
{
SetFuelStationData(buffer, FS_ORDER_ID, idx);
}
case ORDER_TYPE_BUSINESS:
{
SetBusinessData(buffer, B_ORDER_ID, idx);
}
}
}
cache_delete(result);
printf("[Orders]: Çàêàçîâ çàãðóæåíî: %d", rows);
}
