Сообщение от
Pa4enka
new query[ 500 ];
mysql_format(dbHandle, query, sizeof query,
"\
UPDATE bizz SET \
owned = %d, \
owner = %e, \
exortion = %e, \
buyprice = %d, \
entrancecost = %d, \
till = %d, \
locked = %d, \
products = %d, \
maxproducts = %d, \
priceprod = %d, \
2till = %d, \
cena = %d, \
mafia = %d, \
getproducts = %d\
",
BizzInfo[idx][bOwned], BizzInfo[idx][bOwner],
BizzInfo[idx][bExtortion], BizzInfo[idx][bBuyPrice],
BizzInfo[idx][bEntranceCost], BizzInfo[idx][bTill],
BizzInfo[idx][bLocked], BizzInfo[idx][bProducts],
BizzInfo[idx][bMaxProducts], BizzInfo[idx][bPriceProd],
BizzInfo[idx][b2Till], BizzInfo[idx][bCena],
BizzInfo[idx][bMafia], BizzInfo[idx][bID]
);
mysql_tquery(dbHandle, query);
Да спасибо)
PHP код:
stock OnPropUpdate() {
new query[500];
for(new idx = 0; idx < sizeof SBizzInfo; idx++) {
format(query, sizeof(query),
"\
UPDATE \
`sbizz` \
SET \
`owned` = '%d', \
`owner` ='%e', \
`buyprice` = '%d', \
`till` = '%d', \
`locked` ='%d', \
`prod` = '%d', \
`priceprod` = '%d', \
`2till` = '%d', \
`mafia` ='%d', \
`getprod` = '%d' \
WHERE `id` = '%d' \
\
", SBizzInfo[idx][sbOwned],
SBizzInfo[idx][sbOwner],
SBizzInfo[idx][sbBuyPrice],
SBizzInfo[idx][sbTill],
SBizzInfo[idx][sbLocked],
SBizzInfo[idx][sbProducts],
SBizzInfo[idx][sbPriceProd],
SBizzInfo[idx][s2bTill],
SBizzInfo[idx][sbMafia],
SBizzInfo[idx][sbGetProducts],
SBizzInfo[idx][sbID]);
mysql_tquery(dbHandle, query, "", "");
}
for(new idx = 0; idx < sizeof BizzInfo; idx++) {
format(query, sizeof(query),
"\
UPDATE \
`bizz` \
SET \
`owned` = '%d',\
`owner` = '%e',\
`exortion` = '%e',\
`buyprice` = '%d',\
`entrancecost` = '%d',\
`till` = '%d',\
`locked` = '%d',\
`products` = '%d',\
`maxproducts` = '%d',\
`priceprod` = '%d',\
`2till` = '%d',\
`cena` = '%d',\
`mafia` = '%d',\
`getproducts` = '%d'\
WHERE `id` = '%d'\
\
", BizzInfo[idx][bOwned],
BizzInfo[idx][bOwner],
BizzInfo[idx][bExtortion],
BizzInfo[idx][bBuyPrice],
BizzInfo[idx][bEntranceCost],
BizzInfo[idx][bTill],
BizzInfo[idx][bLocked],
BizzInfo[idx][bProducts],
BizzInfo[idx][bMaxProducts],
BizzInfo[idx][bPriceProd],
BizzInfo[idx][b2Till],
BizzInfo[idx][bCena],
BizzInfo[idx][bMafia],
BizzInfo[idx][bGetProducts],
BizzInfo[idx][bID]);
mysql_tquery(dbHandle, query, "", "");
}
print(!"OnPropUpdate() : Бизнесы успешно сохранены ");
return 1;
}
Заметил другую проблему, если прописать через БД ник свой в бизнесе, то он не читает. Загрузка вроде правильно прописана(
PHP код:
forward load_bizz();
public load_bizz() {
static rows;
cache_get_row_count(rows);
new str[120], idx;
for(idx = 0; idx < rows; idx++) {
cache_get_value_name_int(idx, "id", BizzInfo[idx][bID]);
cache_get_value_name_int(idx, "owned", BizzInfo[idx][bOwned]);
cache_get_value_name_int(idx, "buyprice", BizzInfo[idx][bBuyPrice]);
cache_get_value_name_int(idx, "entrancecost", BizzInfo[idx][bEntranceCost]);
cache_get_value_name_int(idx, "till", BizzInfo[idx][bTill]);
cache_get_value_name_int(idx, "locked", BizzInfo[idx][bLocked]);
cache_get_value_name_int(idx, "interior", BizzInfo[idx][bInterior]);
cache_get_value_name_int(idx, "products", BizzInfo[idx][bProducts]);
cache_get_value_name_int(idx, "maxproducts", BizzInfo[idx][bMaxProducts]);
cache_get_value_name_int(idx, "priceprod", BizzInfo[idx][bPriceProd]);
cache_get_value_name_int(idx, "2till", BizzInfo[idx][b2Till]);
cache_get_value_name_int(idx, "cena", BizzInfo[idx][bCena]);
cache_get_value_name_int(idx, "mafia", BizzInfo[idx][bMafia]);
cache_get_value_name_int(idx, "getproducts", BizzInfo[idx][bGetProducts]);
cache_get_value_name(idx, "owner", BizzInfo[idx][bOwner], MAX_PLAYER_NAME);
cache_get_value_name(idx, "message", BizzInfo[idx][bMessage], 255);
cache_get_value_name(idx, "exortion", BizzInfo[idx][bExtortion], 255);
cache_get_value_name_float(idx, "entrance_x", BizzInfo[idx][bEntranceX]);
cache_get_value_name_float(idx, "entrance_y", BizzInfo[idx][bEntranceY]);
cache_get_value_name_float(idx, "entrance_z", BizzInfo[idx][bEntranceZ]);
cache_get_value_name_float(idx, "exit_x", BizzInfo[idx][bExitX]);
cache_get_value_name_float(idx, "exit_y", BizzInfo[idx][bExitY]);
cache_get_value_name_float(idx, "exit_z", BizzInfo[idx][bExitZ]);
cache_get_value_name_float(idx, "bar_x", BizzInfo[idx][bBarX]);
cache_get_value_name_float(idx, "bar_y", BizzInfo[idx][bBarY]);
cache_get_value_name_float(idx, "bar_z", BizzInfo[idx][bBarZ]);
if(BizzInfo[idx][bProducts] > 50000) BizzInfo[idx][bProducts] = 50000;
if(BizzInfo[idx][bOwned] == 0) {
CreateDynamicPickup(19132, 1, BizzInfo[idx][bEntranceX], BizzInfo[idx][bEntranceY], BizzInfo[idx][bEntranceZ]);
format(str, sizeof(str), "Цена: %d\nБизнес продаётся",BizzInfo[idx][bBuyPrice]);
BizzInfo[idx][bLocked] = 1;
BizzInfo[idx][bGetProducts] = 0;
BizzInfo[idx][bTill] = 0;
BizzInfo[idx][b2Till] = 0;
BizzInfo[idx][bCena] = 100;
BizzInfo[idx][bEntranceCost] = 100;
BizzInfo[idx][bMaxProducts] = 50000;
BizzInfo[idx][bLabel] = Create3DTextLabel("~~~~~~~~~~~~~~~~~\nИспользуйте команду\nв данном месте\n~~~~~~~~~~~~~~~~~",COLOR_YELLOW,BizzInfo[idx][bBarX],BizzInfo[idx][bBarY],BizzInfo[idx][bBarZ],20.0,0,1);
BizzInfo[idx][bLabel] = Create3DTextLabel(str,COLOR_YELLOW,BizzInfo[idx][bEntranceX], BizzInfo[idx][bEntranceY], BizzInfo[idx][bEntranceZ],20.0,0,1);
}
if(BizzInfo[idx][bOwned] == 1) {
CreateDynamicPickup(19132, 1, BizzInfo[idx][bEntranceX], BizzInfo[idx][bEntranceY], BizzInfo[idx][bEntranceZ]);
format(str,sizeof(str), "%s\nВладелец:\n %s", BizzInfo[idx][bMessage], BizzInfo[idx][bOwner]);
BizzInfo[idx][bLabel] = Create3DTextLabel(str,TEAM_GROVE_COLOR,BizzInfo[idx][bEntranceX], BizzInfo[idx][bEntranceY], BizzInfo[idx][bEntranceZ],20.0,0,1);
}
BizzInfo[idx][bAreaEnter] = CreateDynamicSphere(BizzInfo[idx][bEntranceX], BizzInfo[idx][bEntranceY], BizzInfo[idx][bEntranceZ], 1.3, 0, 0, -1);
}
printf("[MYSQL_BIZZ]: Загружено %i бизнесов", idx);
}