20.05.2018, 11:42
Hey.
Please tell me how to make a new item in the inventory issued in the last line, not the first.
Please tell me how to make a new item in the inventory issued in the last line, not the first.
PHP код:
stock SetPlayerMenuItems(playerid)
{
new Number;
new query_string[500];
for(new i; i < MAX_ITEMS; i ++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, Item[i][iPos][0], Item[i][iPos][1], Item[i][iPos][2]))
{
if(Number ++ < 10)
{
format(Others, sizeof(Others), "%s\n", NameItem[Item[i][iSubject]]), strcat(query_string, Others);
pInfo[playerid][gItemID][Number - 1] = Number;
pInfo[playerid][gItemSU][Number - 1] = Item[i][iSubject];
pInfo[playerid][gItemIB][Number - 1] = i;
}
}
}
switch(Number)
{
default: ShowPlayerDialog(playerid, dInvPick, DIALOG_STYLE_LIST, "Поверхность", query_string, "Далее", "Закрыть");
}
return true;
}
stock ShowPlayerDialogItem(playerid)
{
if(pInfo[playerid][gBag] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{FF4500}| {FFFFFF}У Вас нет рюкзака.");
new Number;
new query_string[500];
for(new i; i < MAX_PLAYER_ITEM; i ++)
{
switch(pInfo[playerid][gItem][i])
{
case 0: pInfo[playerid][gItemNU][i] = - 1, pInfo[playerid][gItemOB][i] = -1;
default:
{
Number ++, format(Others, sizeof(Others), "%s %d\n", NameItem[i], pInfo[playerid][gItem][i]);
strcat(query_string, Others);
pInfo[playerid][gItemNU][i] = Number - 1;
pInfo[playerid][gItemOB][i] = i;
}
}
}
switch(Number)
{
case 0: SendClientMessage(playerid,COLOR_WHITE,"{FF4500}| {FFFFFF}Ваш рюкзак пуст.");
default: ShowPlayerDialog(playerid, dInv, DIALOG_STYLE_LIST, "Рюкзак", query_string, "Далее", "Закрыть");
}
return true;
}
/* ======================================================================== */
stock GetPlayerSlotItemsEx(playerid)
{
new Var;
for(new i; i < MAX_PLAYER_ITEM; i ++)
{
Var += pInfo[playerid][gItem][i];
}
return Var;
}
/* ======================================================================== */
stock GetPlayerSlotItems(playerid)
{
new Var[2];
for(new i; i < MAX_PLAYER_ITEM; i ++) Var[1] += pInfo[playerid][gItem][i];
switch(pInfo[playerid][gBag])
{
case 0: Var[0] = 10;
case 1: Var[0] = 20;
case 2: Var[0] = 30;
case 3: Var[0] = 40;
}
if(Var[0] <= Var[1]) return true;
return false;
}
/* ======================================================================== */
stock SetPlayerItem(playerid, item, var)
{
new query_string[500];
switch(var < 0)
{
case 0: format(query_string, sizeof(query_string), "Вы подняли %d %s.", var, NameItem[item]);
default: format(query_string, sizeof(query_string), "Вы выбросили %d %s.", var * -1, NameItem[item]);
}
pInfo[playerid][gItem][item] += var;
SendClientMessage(playerid,COLOR_WHITE,query_string);
return true;
}