SA-MP Forums Archive
[Help] Armour cmd - 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: [Help] Armour cmd (/showthread.php?tid=189863)



[Help] Armour cmd - NotoriousMOB - 13.11.2010

Hi why won't this work it gives me the armour but it wont take the money for it.

Код:
if(strcmp(cmd,"/armour",true)==0)
	{
   			if(GetPlayerMoney(playerid) < 1500)
   			{
   			SendClientMessage(playerid,COLOR_RED,"** Sorry, you do not have enough cash. You need $1500!");
   			}
   			else
   			{
   			SetPlayerArmour(playerid,100);
   			}
   		if(!IsPlayerInRangeOfPoint(playerid, 10, 316.524994,-167.706985,999.661987) || IsPlayerInRangeOfPoint(playerid, 3,316.524994,-167.706985,999.661987))
   			{
   			SendClientMessage(playerid,COLOR_RED,"** Sorry, you are not in a store.");
   			}
	  return 1;
 	}



Re: [Help] Armour cmd - Basicz - 13.11.2010

Try this.
pawn Код:
if(strcmp(cmd,"/armour",true)==0)
    {
            if(GetPlayerMoney(playerid) < 1500)
            {
            SendClientMessage(playerid,COLOR_RED,"** Sorry, you do not have enough cash. You need $1500!");
            }
            else
            {
            SetPlayerArmour(playerid,100);
                        GivePlayerMoney(playerid, -1500); //
            }
        if(!IsPlayerInRangeOfPoint(playerid, 10, 316.524994,-167.706985,999.661987) || IsPlayerInRangeOfPoint(playerid, 3,316.524994,-167.706985,999.661987))
            {
            SendClientMessage(playerid,COLOR_RED,"** Sorry, you are not in a store.");
            }
      return 1;
    }



Re: [Help] Armour cmd - NotoriousMOB - 13.11.2010

Thanks man
worked out :P


Re: [Help] Armour cmd - black_dota - 13.11.2010

CMD:

pawn Код:
OnPlayerCommandText(playerid,cmdtext)
{
    if(strcmp(cmd,"/armour",true) == 0)
    {
        if(GetPlayerMoney(playerid) < 1500) // you need 1500 dolars to buy it or else you cant buy
        {
            SendClientMessage(playerid,COLOR_RED,"** Sorry, you do not have enough cash. You need $1500!");
            }
            else
            {
                SetPlayerArmour(playerid,100);
                GivePlayerMoney(playerid, -1500); // It Takes 1500 dolars
            }
            if(!IsPlayerInRangeOfPoint(playerid, 10, 316.524994,-167.706985,999.661987) || IsPlayerInRangeOfPoint(playerid, 3,316.524994,-167.706985,999.661987))
            {
                SendClientMessage(playerid,COLOR_RED,"** Sorry, you are not in a store.");
            }
            return 1;
        }
    }
}
DCMD:

pawn Код:
OnPlayerCommandText(playerid,cmdtext)
{
    dcmd(armour ,6 ,cmdtext);
    return 1;
}

dcmd_armour(playerid, params[])
{
    if(GetPlayerMoney(playerid) < 1500) // you need 1500 dolars to buy it or else you cant buy
    {
        SendClientMessage(playerid,COLOR_RED,"** Sorry, you do not have enough cash. You need $1500!");
    }
    else
    {
        SetPlayerArmour(playerid,100);
        GivePlayerMoney(playerid, -1500); // It Takes 1500 dolars
    }
    if(!IsPlayerInRangeOfPoint(playerid, 10, 316.524994,-167.706985,999.661987) || IsPlayerInRangeOfPoint(playerid, 3,316.524994,-167.706985,999.661987))
    {
        SendClientMessage(playerid,COLOR_RED,"** Sorry, you are not in a store.");
    }
        return 1;
    }
}
ZCMD:

pawn Код:
CMD:armour(playerid, params[])
{
    if(GetPlayerMoney(playerid) < 1500) // you need 1500 dolars to buy it or else you cant buy
    {
        SendClientMessage(playerid,COLOR_RED,"** Sorry, you do not have enough cash. You need $1500!");
    }
    else
    {
        SetPlayerArmour(playerid,100);
        GivePlayerMoney(playerid, -1500); // It Takes 1500 dolars
    }
    if(!IsPlayerInRangeOfPoint(playerid, 10, 316.524994,-167.706985,999.661987) || IsPlayerInRangeOfPoint(playerid, 3,316.524994,-167.706985,999.661987))
    {
        SendClientMessage(playerid,COLOR_RED,"** Sorry, you are not in a store.");
    }
        return 1;
    }
}



Re: [Help] Armour cmd - Basicz - 13.11.2010

Your welcome.
Sorry for the bad identation.


Re: [Help] Armour cmd - Gh0sT_ - 13.11.2010

maybe just.
if(strcmp(cmd,"/armour",true) == 0)
{
if(GetPlayerMoney(playerid) < 1500) return SendClientMessage(playerid,COLOR_RED,"** Sorry, you do not have enough cash. You need $1500!");
if(!IsPlayerInRangeOfPoint(playerid, 10, 316.524994,-167.706985,999.661987) || IsPlayerInRangeOfPoint(playerid, 3,316.524994,-167.706985,999.661987)) return SendClientMessage(playerid,COLOR_RED,"** Sorry, you are not in a store.");
SetPlayerArmour(playerid,100);
GivePlayerMoney(playerid, -1500); // It Takes 1500 dolars
return 1;
}


Re: [Help] Armour cmd - black_dota - 13.11.2010

i put dcmd,zcmd and cmd because someone maybe need zcmd or dcmd command


Re: [Help] Armour cmd - Vince - 13.11.2010

Then you might as well check program flow. The armor command you put up will always work if the player has sufficient money, regardless of their current position. The position is only checked after the main part.