Фальшивый инвентарь

Статус
В этой теме нельзя размещать новые ответы.

Steve_Stage

Интересующийся
Пользователь
Регистрация
12 Июл 2019
Сообщения
35
Реакции
2
Проблема заключается в том, что при выдаче дигла выдается и м4, и так далее
Вот код:

PHP:
case 13:
		{
		    if(response)
		    {
		        switch(listitem)
		        {
		            case 0:
		            {
                        // GetPlayerWeapon(playerid), GetPlayerAmmo(playerid) - получение оружия и патрон
		                //
		                // 1 слот
		                //
		                if(player[playerid][pItem1] == 1) // Бургер
		                {
		                    new Float:health_eat;
							GetPlayerHealth(playerid, health_eat);
							if(health_eat >= 100.0)
							{
							    SCM(playerid, COLOR_YELLOW, !"Вы сыты");
							    return true;
							}
							else
	   						{
		                    	SCM(playerid, COLOR_YELLOW, !"Вы съели бургер, ваше здоровье пополнилось на 20 единиц");
		                    	SetPlayerHealth(playerid, health_eat+20.0);
		                    	player[playerid][pItem1] = 0;
							}
		                }
		                if(player[playerid][pItem1] == 2) // Пепси
		                {
                            new Float:health_drink;
							GetPlayerHealth(playerid, health_drink);
							if(health_drink >= 100.0)
							{
							    SCM(playerid, COLOR_YELLOW, !"Вы не имеете жажды");
							    return true;
							}
							else
	   						{
		                    	SCM(playerid, COLOR_YELLOW, !"Вы выпили Пепси-Колу, ваше здоровье пополнилось на 10 единиц");
		                    	SetPlayerHealth(playerid, health_drink+10.0);
		                    	player[playerid][pItem1] = 0;
							}
		                }
		                if(player[playerid][pItem1] == 3) // Дигл
		                {
       						GivePlayerWeapon(playerid, 24, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo1]);
       						player[playerid][pItem1] = 0;
			 				player[playerid][pItemAmmo1] = 0;
		                }
		                if(player[playerid][pItem1] == 4) // Дробаш
		                {
                            GivePlayerWeapon(playerid, 25, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo1]);
                            player[playerid][pItem1] = 0;
			 				player[playerid][pItemAmmo1] = 0;
		                }
		                if(player[playerid][pItem1] == 5) // М-ка
		                {
                            GivePlayerWeapon(playerid, 31, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo1]);
                            player[playerid][pItem1] = 0;
			 				player[playerid][pItemAmmo1] = 0;
		                }
		                if(player[playerid][pItem1] == 6) // Калаш
		                {
                            GivePlayerWeapon(playerid, 30, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo1]);
                            player[playerid][pItem1] = 0;
			 				player[playerid][pItemAmmo1] = 0;
		                }
		                if(player[playerid][pItem1] == 7) // Бита
		                {
                            GivePlayerWeapon(playerid, 5, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo1]);
                            player[playerid][pItem1] = 0;
			 				player[playerid][pItemAmmo1] = 0;
		                }
		                //
		                // 2 слот
		                //
		                if(player[playerid][pItem2] == 1) // Бургер
		                {
		                    new Float:health_eat;
							GetPlayerHealth(playerid, health_eat);
							if(health_eat >= 100.0)
							{
							    SCM(playerid, COLOR_YELLOW, !"Вы сыты");
							    return true;
							}
							else
	   						{
		                    	SCM(playerid, COLOR_YELLOW, !"Вы съели бургер, ваше здоровье пополнилось на 20 единиц");
		                    	SetPlayerHealth(playerid, health_eat+20.0);
		                    	player[playerid][pItem2] = 0;
			 					player[playerid][pItemAmmo2] = 0;
							}
		                }
		                if(player[playerid][pItem2] == 2) // Пепси
		                {
                            new Float:health_drink;
							GetPlayerHealth(playerid, health_drink);
							if(health_drink >= 100.0)
							{
							    SCM(playerid, COLOR_YELLOW, !"Вы не имеете жажды");
							    return true;
							}
							else
	   						{
		                    	SCM(playerid, COLOR_YELLOW, !"Вы выпили Пепси-Колу, ваше здоровье пополнилось на 10 единиц");
		                    	SetPlayerHealth(playerid, health_drink+10.0);
		                    	player[playerid][pItem2] = 0;
			 					player[playerid][pItemAmmo2] = 0;
							}
		                }
		                if(player[playerid][pItem2] == 3) // Дигл
		                {
       						GivePlayerWeapon(playerid, 24, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo2]);
       						player[playerid][pItem2] = 0;
	 						player[playerid][pItemAmmo2] = 0;
		                }
		                if(player[playerid][pItem2] == 4) // Дробаш
		                {
                            GivePlayerWeapon(playerid, 25, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo2]);
                            player[playerid][pItem2] = 0;
	 						player[playerid][pItemAmmo2] = 0;
		                }
		                if(player[playerid][pItem2] == 5) // М-ка
		                {
                            GivePlayerWeapon(playerid, 31, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo2]);
                            player[playerid][pItem2] = 0;
	 						player[playerid][pItemAmmo2] = 0;
		                }
		                if(player[playerid][pItem2] == 6) // Калаш
		                {
                            GivePlayerWeapon(playerid, 30, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo2]);
                            player[playerid][pItem2] = 0;
	 						player[playerid][pItemAmmo2] = 0;
		                }
		                if(player[playerid][pItem2] == 7) // Бита
		                {
                            GivePlayerWeapon(playerid, 5, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo2]);
                            player[playerid][pItem2] = 0;
	 						player[playerid][pItemAmmo2] = 0;
		                }
		                //
		                // 3 слот
		                //
		                if(player[playerid][pItem3] == 1) // Бургер
		                {
		                    new Float:health_eat;
							GetPlayerHealth(playerid, health_eat);
							if(health_eat >= 100.0)
							{
							    SCM(playerid, COLOR_YELLOW, !"Вы сыты");
							    return true;
							}
							else
	   						{
		                    	SCM(playerid, COLOR_YELLOW, !"Вы съели бургер, ваше здоровье пополнилось на 20 единиц");
		                    	SetPlayerHealth(playerid, health_eat+20.0);
		                    	player[playerid][pItem3] = 0;
							}
		                }
		                if(player[playerid][pItem3] == 2) // Пепси
		                {
                            new Float:health_drink;
							GetPlayerHealth(playerid, health_drink);
							if(health_drink >= 100.0)
							{
							    SCM(playerid, COLOR_YELLOW, !"Вы не имеете жажды");
							}
							else
	   						{
		                    	SCM(playerid, COLOR_YELLOW, !"Вы выпили Пепси-Колу, ваше здоровье пополнилось на 10 единиц");
		                    	SetPlayerHealth(playerid, health_drink+10.0);
		                    	player[playerid][pItem3] = 0;
							}
		                }
		                if(player[playerid][pItem3] == 3) // Дигл
		                {
       						GivePlayerWeapon(playerid, 24, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo3]);
       						player[playerid][pItem3] = 0;
	 						player[playerid][pItemAmmo3] = 0;
		                }
		                if(player[playerid][pItem3] == 4) // Дробаш
		                {
                            GivePlayerWeapon(playerid, 25, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo3]);
                            player[playerid][pItem3] = 0;
	 						player[playerid][pItemAmmo3] = 0;
		                }
		                if(player[playerid][pItem3] == 5) // М-ка
		                {
                            GivePlayerWeapon(playerid, 31, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo3]);
                            player[playerid][pItem3] = 0;
	 						player[playerid][pItemAmmo3] = 0;
		                }
		                if(player[playerid][pItem3] == 6) // Калаш
		                {
                            GivePlayerWeapon(playerid, 30, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo3]);
                            player[playerid][pItem3] = 0;
	 						player[playerid][pItemAmmo3] = 0;
		                }
		                if(player[playerid][pItem3] == 7) // Бита
		                {
                            GivePlayerWeapon(playerid, 5, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo3]);
                            player[playerid][pItem3] = 0;
	 						player[playerid][pItemAmmo3] = 0;
		                }
		                return true;
		            }
		        }
		    }
		}
 

Steve_Stage

Интересующийся
Пользователь
Регистрация
12 Июл 2019
Сообщения
35
Реакции
2
Решено! Надо просто в конце каждой проверки добавить "return true;"
Вот образец:

HTML:
if(player[playerid][pItem1] == 3) // Дигл
		                {
       						GivePlayerWeapon(playerid, 24, GetPlayerAmmo(playerid)+player[playerid][pItemAmmo1]);
       						player[playerid][pItem1] = 0;
			 			player[playerid][pItemAmmo1] = 0;
			 			return true;
		                }
Закрыто
 

Serg_Brain

• Администратор •
Команда форума
Administrator
Регистрация
15 Янв 2012
Сообщения
3,931
Реакции
257
Закрыто, проблема решена.
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи онлайн

Реклама

Сверху