Specific item(array) removal
#1

Hey Guys.
I've restarted pawno scripting just a couple of months ago after some years of brake. I'm using an inventory system by Ivan_Ino's ArrayList method (https://sampforum.blast.hk/showthread.php?tid=608635).
How can I get and remove one specific item from the inventory? I'm thinking about making a stock with this function, I just can't find the proper way to do it.
The thing would be that if someone's in a mission, has the proper item in his inventory, in a proper distance from the NPC (actor), and presses the proper key, he would give the item to the NPC (just lose it from the inventory). I know how to solve these things, my only problem is the specific item removal

I've figured it out that I will need to make the player "in a mission", so i've created

Код:
new inmission[MAX_PLAYERS];
To make sure about the proper item removal at the proper case, i've also created

Код:
new inmission_lunchbreak[MAX_PLAYERS];
Letting known that the player has the specific item I've created

Код:
new hassandwich[MAX_PLAYERS]; // and a couple of more for ex.: haschips, hasmap etc.
It would look like this:

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys && KEY_SECONDARY_ATTACK) //pressing either "F" or "ENTER"
    {
        if(IsPlayerInRangeOfPoint(playerid, "distance", "x", "y", "z"))
        {
            if(inmission[playerid] == 1)
            {
                if(inmission_lunchbreak[playerid] == 1)
                {
                    //couple of things happening
                    RemoveSpecificItemFromInventory(playerid, ?) // <-- not "slot" like the original removal function, but either item_name or idk ?
                }
            }
        }
    }
    return 1;
}
Can you help me with this one?

EDIT:

RemoveSpecificItemFromInventory(playerid, ?) //<--- the '?' should refer to the item id or what?

Код:
new ItemArray[][]=
{
    {1, "Sandwich"}
    // couple more like {id, "name"}
};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)