pawn Код:
//This is the call under OnGameModeInit
LoadBus()
{
new query[500];
format(query, sizeof(query), "SELECT * FROM `Business`");
mysql_function_query(dbHandle, query, true, "BusLoad", "");
return 1;
}
public BusLoad()
{
new rows,
fields,
temp[100],
busname[128],
owner[32];
cache_get_data(rows, fields);
for (new i; i < rows; i++)
{
cache_get_row(i, 0, busname), format(BusInfo[i][BusName], 128, "%s", busname);
cache_get_row(i, 1, temp), BusInfo[i][BusIncome] = strval(temp);
cache_get_row(i, 2, temp), BusInfo[i][Price] = strval(temp);
BusInfo[i][CPX] = cache_get_row_float(i, 3);
BusInfo[i][CPY] = cache_get_row_float(i, 4);
BusInfo[i][CPZ] = cache_get_row_float(i, 5);
cache_get_row(i, 6, temp), BusInfo[i][BusID] = strval(temp);
cache_get_row(i, 7, owner), format(BusInfo[i][Owner], 32, "%s", owner);
BusInfo[i][iX] = cache_get_row_float(i, 8);
BusInfo[i][iY] = cache_get_row_float(i, 9);
BusInfo[i][iZ] = cache_get_row_float(i, 10);
cache_get_row(i, 11, temp), BusInfo[i][Owned] = strval(temp);
cache_get_row(i, 12, temp), BusInfo[i][cIDOwner] = strval(temp);
cache_get_row(i, 13, temp), BusInfo[i][Interior] = strval(temp);
cache_get_row(i, 14, temp), BusInfo[i][VirtualWorld] = strval(temp);
new labeltext[220];
if(BusInfo[i][Owned] == 0)
{
if((BusInfo[i][iX] > 0) && (BusInfo[i][iZ] > 0) && (BusInfo[i][iZ] > 0))
{
format(labeltext, sizeof(labeltext), "{00FF33}%s\n{FFFFFF}Price: {33FF00}${FFFFFF}%d\n{00FF33}For Sale!", BusInfo[i][BusName], BusInfo[i][Price]);
}
else if((BusInfo[i][iX] == 0) && (BusInfo[i][iZ] == 0) && (BusInfo[i][iZ] == 0))
{
format(labeltext, sizeof(labeltext), "{FF0000}%s\n{FFFFFF}Price: {33FF00}${FFFFFF}%d\n{00FF33}For Sale!", BusInfo[i][BusName], BusInfo[i][Price]);
}
}
else
{
if((BusInfo[i][iX] > 0) && (BusInfo[i][iZ] > 0) && (BusInfo[i][iZ] > 0))
{
format(labeltext, sizeof(labeltext), "{00FF33}%s\n{FFFFFF}Owned By: %s", BusInfo[i][BusName], BusInfo[i][Owner]);
}
else if((BusInfo[i][iX] == 0) && (BusInfo[i][iZ] == 0) && (BusInfo[i][iZ] == 0))
{
format(labeltext, sizeof(labeltext), "{FF0000}%s\n{FFFFFF}Owned By: %s", BusInfo[i][BusName], BusInfo[i][Owner]);
}
}
BusLabel[i] = CreateDynamic3DTextLabel(labeltext, COLOR_SNOW, BusInfo[i][CPX], BusInfo[i][CPY], BusInfo[i][CPZ], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
BizzEnter[i] = CreateDynamicPickup(1272, 23, BusInfo[i][CPX], BusInfo[i][CPY], BusInfo[i][CPZ], -1, -1, -1, 100.0);
BusCount ++;
}
return 1;
}
You were also using multiple queries where one would suffice.