Директор
Ученик
Здравствуйте, у меня проблема в системе заправок Mysql. При покупке заправки у меня сохраняет в базу данных но не в тот id заправки которую купил.
Вот команда /buyfuel
Stock:
Вот команда /buyfuel
PHP:
if(IsPlayerConnected(playerid))
{
for(new gas = 0; gas < sizeof(GasInfo); gas++)
{
if(PlayerToPoint(10.0, playerid, GasInfo[gas][gasposX], GasInfo[gas][gasposY], GasInfo[gas][gasposZ]))
{
if(PlayerInfo[playerid][pPnbiskey] != 255 || PlayerInfo[playerid][pPsbiskey] != 255) return SendClientMessage(playerid, COLOR_GREY, "У вас уже есть бизнес!");
if(PlayerInfo[playerid][pBizLic] == 0) return SendClientMessage(playerid, COLOR_WHITE, "Нет лицензии на бизнес (/gps -> 1 -> 4/5");
new string2[300];
GasInfo[gas][GasOwnered] = 1;
strmid(GasInfo[gas][gasnameOwner], PlayerInfo[playerid][pNames], 0, strlen(PlayerInfo[playerid][pNames]), 255);
PlayerInfo[playerid][pPsbiskey] = gas;
if(PlayerInfo[playerid][pCash] < GasInfo[gas][gascenaBuyGas]) return SendClientMessage(playerid,COLOR_GREY,"Недостаточно наличных.");
PlayerInfo[playerid][pCash] -= GasInfo[gas][gascenaBuyGas];
SendClientMessage(playerid, COLOR_GREEN, "Поздравляем, вы купили заправку!");
if(GasInfo[gas][gasOpenOrClosed] == 1)
{
format(string2,sizeof(string2), "{32CD32}%s\n{FFD700}Владелец: %s\n{FF4500}Закрыто", GasInfo[gas][gasmessage], GasInfo[gas][gasnameOwner]);
Update3DTextLabelText(GasInfo[gas][gasLabel], 0xC2A2DAFF, string2);
}
else
{
format(string2,sizeof(string2), "{32CD32}%s\n{FFD700}Владелец: %s\nЦена за литр: {32CD32}%d$", GasInfo[gas][gasmessage], GasInfo[gas][gasnameOwner],GasInfo[gas][gassellfuel]);
Update3DTextLabelText(GasInfo[gas][gasLabel], 0xC2A2DAFF, string2);
}
SaveGas(gas);
OnPlayerUpdateRL(playerid);
}
}
}
PHP:
stock SaveGas(houseid)
{
new update[600],stringer[64];
update = "UPDATE `gas` SET ";
acc_int_strcat(update, sizeof(update), "GOwnered", GasInfo[houseid][GasOwnered]);
acc_str_strcat(update, sizeof(update), "nameOwner", GasInfo[houseid][gasnameOwner]);
acc_int_strcat(update, sizeof(update), "warehouse", GasInfo[houseid][gaswarehouse]);
acc_int_strcat(update, sizeof(update), "Money", GasInfo[houseid][gasmoney]);
acc_int_strcat(update, sizeof(update), "OpenOrClosed", GasInfo[houseid][gasOpenOrClosed]);
acc_int_strcat(update, sizeof(update), "mafia", GasInfo[houseid][gasmafia]);
acc_int_strcat(update, sizeof(update), "cenaBuyGas", GasInfo[houseid][gascenaBuyGas]);
acc_int_strcat(update, sizeof(update), "buyfuel", GasInfo[houseid][gasbuyfuel]);
acc_int_strcat(update, sizeof(update), "sellfuel", GasInfo[houseid][gassellfuel]);
strdel(update, strlen(update)-1, strlen(update));
format(stringer,sizeof(stringer)," WHERE `idGas` = '%d'",houseid);
strcat(update, stringer);
mysql_function_query(connects, update, false, "", "");
}
