stock LoadCargos()
{
new query[256];
for(new i = 1; i < MAX_CARGO; i++)
{
format(query, sizeof(query), "SELECT * FROM cargos WHERE ID=%d", i);
mysql_function_query(handlesql, query, true, "LoadCargo", "d", i);
}
printf("LOADING CARGO...");
return 1;
}
forward LoadCargo(id);
public LoadCargo(id)
{
new fields, rows;
cache_get_data(rows, fields);
if(rows)
{
new fetch[512];
cache_get_field_content(0, "ID", fetch);
CargoInfo[id][ID]= strval(fetch);
cache_get_field_content(0, "Xo", fetch);
CargoInfo[id][Xo] = floatstr(fetch);
cache_get_field_content(0, "Yo", fetch);
CargoInfo[id][Yo] = floatstr(fetch);
cache_get_field_content(0, "Zo", fetch);
CargoInfo[id][Zo] = floatstr(fetch);
cache_get_field_content(0, "Products", fetch);
CargoInfo[id][Products] = strval(fetch);
cache_get_field_content(0, "MaxProducts", fetch);
CargoInfo[id][MaxProducts] = strval(fetch);
cache_get_field_content(0, "Name", fetch);
format(CargoInfo[id][Name], 128, fetch);
cache_get_field_content(0, "Type", fetch);
CargoInfo[id][Type] = strval(fetch);
cache_get_field_content(0, "Price", fetch);
CargoInfo[id][Bank] = strval(fetch);
cache_get_field_content(0, "Tpdaname", fetch);
format(CargoInfo[id][Tpda], 128, fetch);
cache_get_field_content(0, "Tpdaprimary", fetch);
format(CargoInfo[id][Tpdaprimary], 128, fetch);
cache_get_field_content(0, "Open", fetch);
CargoInfo[id][Open] = strval(fetch);
CargoInfo[id][Icon] = CreateDynamicPickup(1318, 1, CargoInfo[id][Xo], CargoInfo[id][Yo], CargoInfo[id][Zo], -1, -1, -1, 50);
new msg[1024];
format(msg, sizeof(msg), "[{E5FF00}%s{FFFFFF}]\n{FFFFFF}Storage: %d / %d\n{FFFFFF}Price: $%d / unit",CargoInfo[id][Name], CargoInfo[id][Products], CargoInfo[id][MaxProducts], CargoInfo[id][Bank]);
CargoInfo[id][Text] = CreateDynamic3DTextLabel(msg, COLOR_WHITE, CargoInfo[id][Xo], CargoInfo[id][Yo], CargoInfo[id][Zo] + 0.7, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1);
Iter_Add(CargoIterator, id);
printf("Cargo %i a fost incarcat! (Name: %s cu tipul %i)", id, CargoInfo[id][Name], CargoInfo[id][Type]);
}
return 1;
}