SA-MP Forums Archive
Inventory, help. - 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: Inventory, help. (/showthread.php?tid=629986)



Inventory, help. - AlexPalermitano97 - 06.03.2017

Quote:

enum iInfo
{
iOccupato,
iSlot1,
iSlot2,
iSlot3,
iSlot4,
iSlot5,
iSlot6,
iSlot7,
iSlot8,
iSlot9,
iSlot10,
};
new InventarioInfo[500][iInfo];

I have a small problem with my inventory system.
I have this enum, how do I do so that I can enter two values?
for example, in Slot1 I want to put DesertEagle (30 ammunition).
Slot2: Drugs (5 grams)
Etc .. How do I insert two values in an enum line?

Thanks


Re: Inventory, help. - Toroi - 06.03.2017

Like this?

Код:
enum iInfo
{
iOccupato,
iSlot1[2],
iSlot2[2],
iSlot3[2],
iSlot4,
iSlot5,
iSlot6,
iSlot7,
iSlot8,
iSlot9,
iSlot10,
};
new InventarioInfo[500][iInfo];
So you call for it like this:

Код:
InventarioInfo[playerid][iSlot1][0] = weaponid;
InventarioInfo[playerid][iSlot1][1] = ammo;



Re: Inventory, help. - AlexPalermitano97 - 06.03.2017

And in saveinventory file what I write? I INI_WRITEINT or INI_WRITESTRING? How to save them both?


Re: Inventory, help. - Toroi - 06.03.2017

The same as the example I gave to you,

It'd be like
Код:
INI_WriteInt("Weaponid",InventarioInfo[playerid][iSlot1][0]);
as that [0] holds the [iSlot1] first value, get it?


Re: Inventory, help. - AlexPalermitano97 - 06.03.2017

Ok,thank's
Ok, and I come to Put What in slot 1 there is a lighter? Come I make a mean What an ad value equivalent to a lighter or a cigarette?
/Layinglighter


Re: Inventory, help. - Toroi - 06.03.2017

You will need to make your own item system, mine is something like:

Код:
#define ITEM_cigarette 1
#define ITEM_lighter 2

InventarioInfo[playerid][iSlot1][0] = ITEM_cigarette;
InventarioInfo[playerid][iSlot1][1] = 2;
InventarioInfo[playerid][iSlot2][0] = ITEM_lighter;
InventarioInfo[playerid][iSlot2][1] = 1;



Re: Inventory, help. - AlexPalermitano97 - 06.03.2017

Thanks