22.02.2012, 16:29
I have this code:
In the 3D text, it only shows the name, not the price. So somehow the price isn't loading, i added a printf under the loading to test, and it always come out as 0, how could I fix this?
pawn Код:
stock LoadBusiness()
{
new Query[400]; new string[128];
for(new id = 1; id < MAX_BUSINESS; id++)
{
format(Query, sizeof(Query), "SELECT * From Business WHERE ID = %d", id);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows())
if(mysql_fetch_row_format(Query,"|"))
{
sscanf(Query, "p<|>is[32]ddffffffiid", BusinessInfo[id][ID], BusinessInfo[id][Name], BusinessInfo[id][Type], BusinessInfo[id][BBank], BusinessInfo[id][Posx], BusinessInfo[id][Posy], BusinessInfo[id][Posz], BusinessInfo[id][EPosx], BusinessInfo[id][EPosy], BusinessInfo[id][EPosz], BusinessInfo[id][Price]);
Total_Business_Created++;
printf("Business: %d",Total_Business_Created);
format(string, sizeof(string), "%s \nPrice: %d \nEnter by using 'Crouch'",BusinessInfo[id][Name],BusinessInfo[id][Price]);
BusinessInfo[id][LabelID] = CreateDynamic3DTextLabel(string, COLOR_WHITE, BusinessInfo[id][Posx],BusinessInfo[id][Posy],BusinessInfo[id][Posz], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 10.0);
BusinessInfo[id][PickupID] = CreateDynamicPickup(1239, 23, BusinessInfo[id][Posx],BusinessInfo[id][Posy],BusinessInfo[id][Posz], 0, 0, -1, 250);
}
}
return 1;
}