PHP код:
stock LoadBusiness()
{
new DB_Query[228];
new string[500];
for(new i; i <= MAX_BUSINESS; i++)
{
mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `BUSINESS` WHERE `ID` = '%d' LIMIT 1", i);
mysql_query(Database, DB_Query);
if(cache_num_rows() > 0)
{
cache_get_value(0, "NAME", Business[i][Name], 128);
cache_get_value_int(0, "TYPE", Business[i][Type]);
cache_get_value_int(0, "PRODUCT", Business[i][Product]);
cache_get_value_int(0, "FEE", Business[i][Fee]);
cache_get_value_int(0, "SAFE", Business[i][Safe]);
cache_get_value_int(0, "OWNER", Business[i][Owner]);
cache_get_value_int(0, "VW", Business[i][Vw]);
cache_get_value_int(0, "INT", Business[i][Int]);
cache_get_value_int(0, "OWNER", Business[i][Owner]);
cache_get_value_int(0, "PRICE", Business[i][Price]);
cache_get_value_name_float(0, "PosX", Business[i][PosX]);
cache_get_value_name_float(0, "PosY", Business[i][PosY]);
cache_get_value_name_float(0, "PosZ", Business[i][PosZ]);
Business[i][Used] = true;
if(Business[i][Owner] != -1)
{
format(string, sizeof(string),"\t ID : %d\nName : %s\nType : %s\nOwner : %s\nEntrance Fee : $ %d",i,Business[i][Name],GetBusinessType(Business[i][Type]),GetNameFromUniqueID(Business[i][Owner]),Business[i][Fee]);
Business[i][BizText] = Create3DTextLabel(string, COLOR_ADMIN, Business[i][PosX], Business[i][PosX], Business[i][PosX], 10.0, Business[i][Vw], Business[i][Int]);
}
else
{
format(string, sizeof(string),"\t ID : %d\nName : NEW BUSINESS\nType : %s\nPrice : %d",i,GetBusinessType(Business[i][Type]),Business[i][Price]);
Business[i][BizText] = Create3DTextLabel(string, COLOR_ADMIN, Business[i][PosX], Business[i][PosX], Business[i][PosX], 10.0, Business[i][Vw], Business[i][Int]);
}
}
else
{
Business[i][Used] = false;
}
}
return 1;
}