SA-MP Forums Archive
Help with inventory. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with inventory. (/showthread.php?tid=654074)



Help with inventory. - Kireykin - 20.05.2018

Hey.
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 
iMAX_ITEMS++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.0Item[i][iPos][0], Item[i][iPos][1], Item[i][iPos][2]))
        {
            if(
Number ++ < 10)
            {
                
format(Otherssizeof(Others), "%s\n"NameItem[Item[i][iSubject]]), strcat(query_stringOthers);
                
pInfo[playerid][gItemID][Number 1] = Number;
                
pInfo[playerid][gItemSU][Number 1] = Item[i][iSubject];
                
pInfo[playerid][gItemIB][Number 1] = i;
            }
        }
    }
    switch(
Number)
    {
        default: 
ShowPlayerDialog(playeriddInvPickDIALOG_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 
iMAX_PLAYER_ITEM++)
    {
        switch(
pInfo[playerid][gItem][i])
        {
            case 
0pInfo[playerid][gItemNU][i] = - 1pInfo[playerid][gItemOB][i] = -1;
            default:
            {
                
Number ++, format(Otherssizeof(Others), "%s %d\n"NameItem[i], pInfo[playerid][gItem][i]);
                
strcat(query_stringOthers);
                
pInfo[playerid][gItemNU][i] = Number 1;
                
pInfo[playerid][gItemOB][i] = i;
            }
        }
    }
    switch(
Number)
    {
        case 
0SendClientMessage(playerid,COLOR_WHITE,"{FF4500}| {FFFFFF}Ваш рюкзак пуст.");
        default: 
ShowPlayerDialog(playeriddInvDIALOG_STYLE_LIST"Рюкзак"query_string"Далее""Закрыть");
    }
    return 
true;
}
/*  ========================================================================  */
stock GetPlayerSlotItemsEx(playerid)
{
    new Var;
    for(new 
iMAX_PLAYER_ITEM++)
    {
        Var += 
pInfo[playerid][gItem][i];
    }
    return Var;
}
/*  ========================================================================  */
stock GetPlayerSlotItems(playerid)
{
    new Var[
2];
    for(new 
iMAX_PLAYER_ITEM++) 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(playeriditem, var)
{
    new 
query_string[500];
    switch(var < 
0)
    {
        case 
0format(query_stringsizeof(query_string), "Вы подняли %d %s.", var, NameItem[item]);
        default: 
format(query_stringsizeof(query_string), "Вы выбросили %d %s.", var * -1NameItem[item]);
    }
    
pInfo[playerid][gItem][item] += var;
    
SendClientMessage(playerid,COLOR_WHITE,query_string);
    return 
true;




Re: Help with inventory. - Kireykin - 21.05.2018

Can you help?


Re: Help with inventory. - TechSil - 21.05.2018

Quote:
Originally Posted by Kireykin
Посмотреть сообщение
Can you help?
Dont replay on your post before anyone replay, they will help you when they see it. Just follow forums rules