Inventory system [+REP]
#1

Hey, i'm trying to make a inventory system for my server, i'm working to make this inventory system works when i buy a weapon from any weapon shop it saves the weapon which i bought to my inventory or also when i buy a medkit it saves to my inventory.

So what i need is how to make a cmd to make show a dialog menu showing all the weapon names i bought from the shop and saved from my inventory.

Here is some codes which i made that may help you for making that for me
Код:
new Bat[MAX_PLAYERS];
new Knuckles[MAX_PLAYERS];
new Grenades[MAX_PLAYERS];
new p9mm[MAX_PLAYERS];
new Shotgun[MAX_PLAYERS];
new MP5[MAX_PLAYERS];
new Tec9[MAX_PLAYERS];
new HalfArmour[MAX_PLAYERS];
new RPG[MAX_PLAYERS];
new Knife[MAX_PLAYERS];
new Molotov[MAX_PLAYERS];
new sdPistol[MAX_PLAYERS];
new SawnOffShotgun[MAX_PLAYERS];
new MicroUzi[MAX_PLAYERS];
new M4[MAX_PLAYERS];
new CountryRifle[MAX_PLAYERS];
new FullArmour[MAX_PLAYERS];
new Minigun[MAX_PLAYERS];
new Kantana[MAX_PLAYERS];
new SatchelCharges[MAX_PLAYERS];
new DesertEagle[MAX_PLAYERS];
new CombatShotgun[MAX_PLAYERS];
new AK47[MAX_PLAYERS];
new Sniper[MAX_PLAYERS];
new FlameThrower[MAX_PLAYERS];
Код:
if(dialogid == ammudiag1)
	{
		if(response)
		{
		    if(listitem == 0)
		    {
				if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
				if(Bat[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
		        Bat[playerid] = 1;
		        GivePlayerMoney(playerid,-1500);
		        SendClientMessage(playerid,0x2D9578FF,"You have added the Baseball Bat to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Bat",Bat[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 1)
		    {
		    	if(GetPlayerMoney(playerid) < 2000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(Knuckles[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                Knuckles[playerid] = 1;
                GivePlayerMoney(playerid,-2000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Brass Knuckles to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Knuckles",Knuckles[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 2)
		    {
				if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
                GivePlayerMoney(playerid,-7000);
                Grenades[playerid] = 7;
                SendClientMessage(playerid,0x2D9578FF,"You have added +7 Grenades to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Grenades",Grenades[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 3)
		    {
		        if(GetPlayerMoney(playerid) < 15000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(p9mm[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                p9mm[playerid] = 1;
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the 9mm to your bag.");
                new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"9mm",p9mm[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 4)
		    {
		        if(GetPlayerMoney(playerid) < 32000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(Shotgun[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                Shotgun[playerid] = 1;
                GivePlayerMoney(playerid,-32000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Shotgun to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Shotgun",Shotgun[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 5)
		    {
		        if(GetPlayerMoney(playerid) < 37000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(MP5[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                MP5[playerid] = 1;
                GivePlayerMoney(playerid,-37000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the MP5 to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"MP5",MP5[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 6)
		    {
		        if(GetPlayerMoney(playerid) < 32000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(Tec9[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                Tec9[playerid] = 1;
                GivePlayerMoney(playerid,-32000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Tec9  to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Tec9",Tec9[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 7)
		    {
		        if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(HalfArmour[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                HalfArmour[playerid] = 1;
                GivePlayerMoney(playerid,-5000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Half Armour to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"HalfArmour",HalfArmour[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 8)
		    {
		        if(GetPlayerMoney(playerid) < 530000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(RPG[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                RPG[playerid] = 1;
                GivePlayerMoney(playerid,-530000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the RPG to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"RPG",RPG[playerid]);
   	 			INI_Close(File);
		    }
		}
	}
	
	if(dialogid == ammudiag2)
	{
		if(response)
		{
		    if(listitem == 0)
		    {
		        if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(Knife[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                Knife[playerid] = 1;
                GivePlayerMoney(playerid,-10000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Knife to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Knife",Knife[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 1)
		    {
		        if(GetPlayerMoney(playerid) < 12000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
				GivePlayerMoney(playerid,-12000);
                Molotov[playerid] = 7;
                SendClientMessage(playerid,0x2D9578FF,"You have added +7 Molotovs to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Molotov",Molotov[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 2)
		    {
		        if(GetPlayerMoney(playerid) < 23000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
				if(sdPistol[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                sdPistol[playerid] = 1;
                GivePlayerMoney(playerid,-23000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Silence Pistol to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"sdPistol",sdPistol[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 3)
		    {
		        if(GetPlayerMoney(playerid) < 83000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(SawnOffShotgun[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                SawnOffShotgun[playerid] = 1;
                GivePlayerMoney(playerid,-83000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Sawn Off Shotgun to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"SawnOffShotgun",SawnOffShotgun[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 4)
			{
		        if(GetPlayerMoney(playerid) < 58000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(MicroUzi[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                MicroUzi[playerid] = 1;
                GivePlayerMoney(playerid,-58000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Micro Uzi to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"MicroUzi",MicroUzi[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 5)
		    {
		        if(GetPlayerMoney(playerid) < 63000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(M4[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                M4[playerid] = 1;
                GivePlayerMoney(playerid,-63000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the M4 to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"M4",M4[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 6)
		    {
		        if(GetPlayerMoney(playerid) < 92000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(CountryRifle[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                CountryRifle[playerid] = 1;
                GivePlayerMoney(playerid,-92000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Country Rifle to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"CountryRifle",CountryRifle[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 7)
		    {
		        if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(FullArmour[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
                FullArmour[playerid] = 1;
                GivePlayerMoney(playerid,-10000);
                SendClientMessage(playerid,0x2D9578FF,"You have added the Full Armour to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"FullArmour",FullArmour[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 8)
		    {
		        if(GetPlayerMoney(playerid) < 760000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(Minigun[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				Minigun[playerid] = 1;
				GivePlayerMoney(playerid,-760000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the Minigun to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Minigun",Minigun[playerid]);
   	 			INI_Close(File);
		    }
		}
	}
	
	if(dialogid == ammudiag3)
	{
		if(response)
		{
		    if(listitem == 0)
		    {
		        if(GetPlayerMoney(playerid) < 40000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(Kantana[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				Kantana[playerid] = 1;
				GivePlayerMoney(playerid,-40000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the Kantana to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Kantana",Kantana[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 1)
		    {
		        if(GetPlayerMoney(playerid) < 50000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
				SatchelCharges[playerid] = 7;
				GivePlayerMoney(playerid,-50000);
				SendClientMessage(playerid,0x2D9578FF,"You have added +7 Satchel Charges to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"SatchelCharges",SatchelCharges[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 2)
		    {
		        if(GetPlayerMoney(playerid) < 70000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(DesertEagle[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				DesertEagle[playerid] = 1;
				GivePlayerMoney(playerid,-70000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the Desert Eagle to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"DesertEagle",DesertEagle[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 3)
		    {
		        if(GetPlayerMoney(playerid) < 170000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(CombatShotgun[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				CombatShotgun[playerid] = 1;
				GivePlayerMoney(playerid,-170000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the Combat Shotgun to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"CombatShotgun",CombatShotgun[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 4)
		    {
		        if(GetPlayerMoney(playerid) < 58000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(MicroUzi[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				MicroUzi[playerid] = 1;
				GivePlayerMoney(playerid,-58000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the Micro Uzi to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"MicroUzi",Bat[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 5)
		    {
		        if(GetPlayerMoney(playerid) < 150000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(AK47[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				AK47[playerid] = 1;
				GivePlayerMoney(playerid,-150000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the AK47 to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"AK47",AK47[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 6)
		    {
		        if(GetPlayerMoney(playerid) < 270000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(Sniper[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				Sniper[playerid] = 1;
				GivePlayerMoney(playerid,-270000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the Sniper to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"Sniper",Sniper[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 7)
		    {
		        if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(FullArmour[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				FullArmour[playerid] = 1;
				GivePlayerMoney(playerid,-10000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the Full Armour to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"FullArmour",FullArmour[playerid]);
   	 			INI_Close(File);
		    }
		    if(listitem == 8)
		    {
		        if(GetPlayerMoney(playerid) < 1000000) return SendClientMessage(playerid,RED,"You don't have enough money for that!");
		    	if(FlameThrower[playerid] == 1) return SendClientMessage(playerid,RED,"You already have this item in your inventory.");
				FlameThrower[playerid] = 1;
				GivePlayerMoney(playerid,-1000000);
				SendClientMessage(playerid,0x2D9578FF,"You have added the Flame Thrower to your bag.");
		      	new INI:File = INI_Open(Path(playerid));
    			INI_SetTag(File,"Player's Data");
   				INI_WriteInt(File,"FlameThrower",FlameThrower[playerid]);
   	 			INI_Close(File);
		    }
		}
	}
Reply


Messages In This Thread
Inventory system [+REP] - by TheSperm - 12.04.2015, 17:44
Re: Inventory system [+REP] - by TheSperm - 12.04.2015, 23:29
Re: Inventory system [+REP] - by n0minal - 12.04.2015, 23:41
Re: Inventory system [+REP] - by TheSperm - 13.04.2015, 00:05
Re: Inventory system [+REP] - by SequenceCuz - 13.04.2015, 07:21
Re: Inventory system [+REP] - by TheSperm - 13.04.2015, 15:33
Re : Inventory system [+REP] - by Dutheil - 13.04.2015, 15:47
Re: Re : Inventory system [+REP] - by TheSperm - 13.04.2015, 16:00
Re: Inventory system [+REP] - by SequenceCuz - 14.04.2015, 04:11
Re: Inventory system [+REP] - by TheSperm - 16.04.2015, 21:17

Forum Jump:


Users browsing this thread: 3 Guest(s)