SA-MP Forums Archive
Buy armor by a 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: Buy armor by a cmd? (/showthread.php?tid=187133)



Buy armor by a cmd? - Face9000 - 01.11.2010

Hai,there is a way to buy armor by a command?

Example: /buyarmor but player need to have 5000$

Thanks


Re: Buy armor by a cmd? - ViruZZzZ_ChiLLL - 01.11.2010

Okay, I will assume you use strcmp :

pawn Код:
if(strcmp("/buyarmor", cmdtext, 9, true) == 0)
{
  if(GetPlayerMoney(playerid) <= 5000) return SendClientMessage(playerid, Red, "ERROR : You don't have enough money!");
  else
  {
    SendClientMessage(playerid, Color, "You now have armor");
    GivePlayerMoney(playerid, -5000)
    SetPlayerArmour(playerid, 100);
  }
  return 1;
}



Re: Buy armor by a cmd? - hadzx - 01.11.2010

or you could do

Код:
if (strcmp("/buyarmour", cmdtext, true, 10) == 0)
	{
	 	if(GetPlayerMoney(playerid) <= 5000)// set how much cash they need
		{
		SendClientMessage(playerid, Color, "Armour Bought For 5000$");
		GivePlayerMoney(playerid, -5000)    
		SetPlayerArmour(playerid, 100);
		}
		else
		{
		SendClientMessage(playerid, Color, "You Dont Have 5000$");
		}
		return 1;
	    }