Help to fix code
#1

I do not know exactly what the problem is, but seeing all sorts of lessons, I think the problem in check
All code written with 0
Code:

Код:
if(!strcmp(inputtext[0],"Пицца",true))
{
    RemoveItem(playerid,"Пицца",1);
    SendClientMessage(playerid, COLOR_WHITE, "Вы выкинули пиццу!");
}
RemoveItem is with include j_inventory
but the function itself looks like this:

Код:
stock RemoveItem(playerid,ItemName[],Amount)
{
    for(new item;item<MAX_ITEMS;item++)
    {
        if(!_GetItemAmountPVar(playerid,item))continue;
        if(!strcmp(_GetItemNamePVar(playerid,item),ItemName,true))
        {
            _SetItemAmountPVar(playerid,item,_GetItemAmountPVar(playerid,item)-Amount);
            if(_GetItemAmountPVar(playerid,item)<=0)_SetItemAmountPVar(playerid,item,0);
            if(_GetItemAmountPVar(playerid,item)>MAX_ITEM_STACK)
            {
                _SetItemAmountPVar(playerid,item,MAX_ITEM_STACK);
                return 2;
            }
            return 1;
        }
    }
    return 0;
}
The lesson should be checking

Код:
if(!strcmp(ItemName,"Пицца",true))
But my code is located in public OnDialogResponse
What to do?
Reply
#2

Код:
if(!strcmp(inputtext,"Пицца",true))
{
    RemoveItem(playerid,"Пицца",1);
    SendClientMessage(playerid, COLOR_WHITE, "Вы выкинули пиццу!");
}
Use this, you put a [0] tag behind inputtext, meaning it'll only check the very first character of inputtext.
Reply
#3

this unfortunately did not help, but I noticed that if you make the lesson all the same the item is not deleted(
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)