26.05.2017, 16:55
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
To make sure about the proper item removal at the proper case, i've also created
Letting known that the player has the specific item I've created
It would look like this:
Can you help me with this one?
EDIT:
RemoveSpecificItemFromInventory(playerid, ?) //<--- the '?' should refer to the item id or what?
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];
Код:
new inmission_lunchbreak[MAX_PLAYERS];
Код:
new hassandwich[MAX_PLAYERS]; // and a couple of more for ex.: haschips, hasmap etc.
Код:
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; }
EDIT:
RemoveSpecificItemFromInventory(playerid, ?) //<--- the '?' should refer to the item id or what?
Код:
new ItemArray[][]= { {1, "Sandwich"} // couple more like {id, "name"} };