Health and armour shop???
#1

Код:
	if(dialogid == DIALOG_EXTRALIST)
	{
		new idx = GetPlayerVirtualWorld(playerid)-100;
		if(response)
		{
  		if(listitem == 0)
		    {
		        if (GetPlayerCash(playerid) >= 250)
		        {
		            GivePlayerCash(playerid, -250);
		            BizInfo[idx][bMoney] += 250;
		            GetPlayerHealth(playerid,health);
					SetPlayerHealth(playerid, 25);
					SendClientMessage(playerid, -1, "You have purchased some Health Pills!");
		        }
		    }
 		    if(listitem == 1)
		    {
		        if (GetPlayerCash(playerid) >= 500)
		        {
		            GivePlayerCash(playerid, -500);
		            BizInfo[idx][bMoney] += 500;
		            GetPlayerHealth(playerid,health);
					SetPlayerHealth(playerid, 50);
					SendClientMessage(playerid, -1, "You have purchased a Health Pack!");
		        }
		    }
		    if(listitem == 2)
		    {
		        if (GetPlayerCash(playerid) >= 750)
		        {
		            GivePlayerCash(playerid, -750);
		            BizInfo[idx][bMoney] += 750;
		            GetPlayerHealth(playerid,health);
					SetPlayerHealth(playerid, 75);
					SendClientMessage(playerid, -1, "You have purchased a Medium Health Pack!");
          		}
		    }
		    if(listitem == 3)
		    {
		        if (GetPlayerCash(playerid) >= 1000)
		        {
		            GivePlayerCash(playerid, -1000);
		            BizInfo[idx][bMoney] += 1000;
		            GetPlayerHealth(playerid,health);
					SetPlayerHealth(playerid, 100);
					SendClientMessage(playerid, -1, "You have purchased a Large Health Pack!");
          		}
		    }
		    if(listitem == 4)
		    {
		        if (GetPlayerCash(playerid) >= 500)
		        {
		            GivePlayerCash(playerid, -500);
		            BizInfo[idx][bMoney] += 500;
		            GetPlayerArmour(playerid,armour);
					SetPlayerArmour(playerid, 50);
					SendClientMessage(playerid, -1, "You have purchased a Broken Armour!");
          		}
		    }
		    if(listitem == 5)
		    {
		        if (GetPlayerCash(playerid) >= 1000)
		        {
		            GivePlayerCash(playerid, -1000);
		            BizInfo[idx][bMoney] += 1000;
		            GetPlayerArmour(playerid,armour)
					SetPlayerArmour(playerid, 100);
					SendClientMessage(playerid, -1, "You have purchased a Strong Kevlar!");
          		}
		    }
How do i make this so it won't go over 100 on the Armour and health, but when you but the packages it will make the health and Armour go up to 100. I would like it so if you chose the strong Kevlar and this will make it go over 100 limit it stops you from buying it?

Any help would be great, Or even if you could do it for me even better
Reply
#2

Just check them health or armour higher than 100 return error message

Example:
pawn Код:
if(dialogid == DIALOG_EXTRALIST)
    {
        new Float:health,
            Float:armour,
            idx = GetPlayerVirtualWorld(playerid)-100;

       
        if(response)
        {
                       
            GetPlayerHealth(playerid,health);
            GetPlayerArmour(playerid,armour);
            if(listitem == 0)
            {
                if(health >= 100) return SendClientMessage(playerid, -1, "Your Health is Full !");
                if (GetPlayerCash(playerid) >= 250)
                {
                    GivePlayerCash(playerid, -250);
                    BizInfo[idx][bMoney] += 250;
                    if((health += 25) >= 100) { health = 100.0; }
                    SetPlayerHealth(playerid, health);
                    SendClientMessage(playerid, -1, "You have purchased some Health Pills!");
                }
            }
            if(listitem == 1)
            {
                if(health >= 100) return SendClientMessage(playerid, -1, "Your Health is Full !");
                if (GetPlayerCash(playerid) >= 500)
                {
                    GivePlayerCash(playerid, -500);
                    BizInfo[idx][bMoney] += 500;
                    if((health += 50) >= 100) { health = 100.0; }
                    SetPlayerHealth(playerid, health);
                    SendClientMessage(playerid, -1, "You have purchased a Health Pack!");
                }
            }
            if(listitem == 2)
            {
                if(health >= 100) return SendClientMessage(playerid, -1, "Your Health is Full !");
                if (GetPlayerCash(playerid) >= 750)
                {
                    GivePlayerCash(playerid, -750);
                    BizInfo[idx][bMoney] += 750;
                    if((health += 75) >= 100) { health = 100.0; }
                    SetPlayerHealth(playerid, health);
                    SendClientMessage(playerid, -1, "You have purchased a Medium Health Pack!");
                }
            }
            if(listitem == 3)
            {
                if(health >= 100) return SendClientMessage(playerid, -1, "Your Health is Full !");
                if (GetPlayerCash(playerid) >= 1000)
                {
                    GivePlayerCash(playerid, -1000);
                    BizInfo[idx][bMoney] += 1000;
                    SetPlayerHealth(playerid, 100);
                    SendClientMessage(playerid, -1, "You have purchased a Large Health Pack!");
                }
            }
            if(listitem == 4)
            {
                if(armour >= 100) return SendClientMessage(playerid, -1, "Your Armour is Full !");
                if (GetPlayerCash(playerid) >= 500)
                {
                    GivePlayerCash(playerid, -500);
                    BizInfo[idx][bMoney] += 500;
                    if((armour += 50) >= 100) { armour = 100.0; }
                    SetPlayerArmour(playerid, armour);
                    SendClientMessage(playerid, -1, "You have purchased a Broken Armour!");
                }
            }
            if(listitem == 5)
            {
                if(armour >= 100) return SendClientMessage(playerid, -1, "Your Armour is Full !");
                if (GetPlayerCash(playerid) >= 1000)
                {
                    GivePlayerCash(playerid, -1000);
                    BizInfo[idx][bMoney] += 1000;
                   
                    SetPlayerArmour(playerid, 100);
                    SendClientMessage(playerid, -1, "You have purchased a Strong Kevlar!");
                }
            }
Reply
#3

thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)