SA-MP Forums Archive
Checking Armour - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Checking Armour (/showthread.php?tid=145567)



Checking Armour - Anthony_Brassi - 02.05.2010

Hey, I've got an odd question, which many of you probibly get asked a billion times a day, but is it possible to set armour on top of what a person has?

Like,

GetPlayerArmour(playerid);
IfPlayerArmour == 50
SetPlayerArmour(playerid, +50);


The reason im asking is I'm setting up a dialog,


Код:
		}
		if(listitem == 6)
		{
		SetPlayerArmour(playerid,+70);
		}
		if(listitem == 7)
		{
		SetPlayerArmour(playerid,+80);
		}
		if(listitem == 8)
		{
		SetPlayerArmour(playerid,+90);
		}
		if(listitem == 9)
		{
		SetPlayerArmour(playerid,+100);
		}
ETC, Anyways...It's being set up, so that

If they've got 50 Armor they can't buy more then 50, It will say You can't go higher then 100 armor, Somthing like that, If you can help, It'd be greatly appreciated


Re: Checking Armour - aircombat - 02.05.2010

here is how u give a +

Код:
new Float:Armour; GetPlayerArmour(playerid,Armour);
SetPlayerArmour(playerid,Armour+50);



Re: Checking Armour - Anthony_Brassi - 02.05.2010

Quote:
Originally Posted by Etch ❽ H
here is how u give a +

Код:
new Float:Armour; GetPlayerArmour(playerid,Armour);
SetPlayerArmour(playerid,Armour+50);
ah, thanks I'll try it

EDIT: But how is that gonna limit it to 100 armor?


Re: Checking Armour - aircombat - 02.05.2010

what u mean limit it to 100??


Re: Checking Armour - Anthony_Brassi - 02.05.2010

Quote:
Originally Posted by Etch ❽ H
what u mean limit it to 100??
So, Like

GetPlayerArmour(playerid);
IfPlayerArmourIfPlayerArmour(playerid, > 99) return SendClientMessage(COLOR, "You can't buy more then 100 Armor!");



Re: Checking Armour - Miguel - 02.05.2010

Quote:
Originally Posted by Anthony_Brassi
Quote:
Originally Posted by Etch ❽ H
what u mean limit it to 100??
So, Like
GetPlayerArmour(playerid);
IfPlayerArmourIfPlayerArmour(playerid, > 99) return SendClientMessage(COLOR, "You can't buy more then 100 Armor!");
pawn Код:
new
  string[128],
  Float:amount,
  Float:limit,
  Float:Armour;

GetPlayerArmour(playerid, Armour);
limit = floatsub(100, Armour);
if(amount > limit)
{
  format(string, sizeof(string), "You can't buy more than %.2f Armour!", limit);
  SendClientMessage(playerid, RED, string);
}



Re: Checking Armour - aircombat - 02.05.2010

new Float:Armour; GetPlayerArmour(playerid,Armour);
Код:
if(Armour > 99) return SendClientMessage(etc....)



Re: Checking Armour - Anthony_Brassi - 02.05.2010

Quote:
Originally Posted by Etch ❽ H
new Float:Armour; GetPlayerArmour(playerid,Armour);
Код:
if(Armour > 99) return SendClientMessage(etc....)
that worked, but I've got a little problem >_>
pawn Код:
if(dialogid == DIALOGID)
    {
        if(response)
        {
            if(listitem == 0)
            {
       ShowPlayerDialog(playerid, DIALOGARMOR, DIALOG_STYLE_LIST, "Armor", "10\n20\n30\n40\n50\n60\n70\n80\n90", "Select", "Cancel");
            }
This Code below still uses the values from the dialog "DIALOGID", so like If I go to buy armor, Instead of using the Menu For Armor, It says "You Just bought a Knife" Etc.
pawn Код:
if(dialogid == 3 )// quick find ArmorShop
    {
    if (response == 1)
    {
      switch (listitem)
      {
      case 0:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
            if(Armour > 99) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
      SetPlayerArmour(playerid,Armour+10);
      }
      case 1:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      SetPlayerArmour(playerid,Armour+20);
      if(Armour > 89) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
            }
      case 2:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      if(Armour > 79) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
        SetPlayerArmour(playerid,Armour+30);
      }
      case 3:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      if(Armour > 69) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
        SetPlayerArmour(playerid,Armour+40);
      }
      case 4:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      if(Armour > 59) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
          SetPlayerArmour(playerid,Armour+50);
          }
      case 5:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      if(Armour > 49) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
            SetPlayerArmour(playerid,Armour+60);
      }
      case 6:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      if(Armour > 39) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
             SetPlayerArmour(playerid,Armour+70);
      }
      case 7:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      if(Armour > 29) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
             SetPlayerArmour(playerid,Armour+80);
      }
      case 8:
      {
      new Float:Armour;
            GetPlayerArmour(playerid,Armour);
      if(Armour > 19) return SendClientMessage(playerid, COLOR_GREY, " You can't buy more then 100 Armor!");
        SetPlayerArmour(playerid,Armour+90);
      }
        }
BTW, I probibly sound like a nub, but This is the first time I've edited a Dialog :/


Re: Checking Armour - Anthony_Brassi - 03.05.2010

bump