Bracket of SendClientMessage
#1

Hi all...
I'm getting tired from that brackets...
I have some problems with bracket on my cmd /buy, i tried a lot of tries but nothing works.
so what i want is: when player is at 24/7 market and he type /buy vest it will SCM to him "You are not at the Goverment Ammunation"
when player is on ammunation and type /buy speedomter it will SCM "You are not at 24/7"

Here some SS to show you the problem: (Its not the full code but with strcmp function is all same so i just gave an exmaple)

24/7 market sends unnecessary SCM:



ammunation doesn't respond -_-




and there is the command:

Код:
CMD:buy(playerid, params[])
{
	new idx = GetPlayerVirtualWorld(playerid)-100, string[128], price, bizlevel;
	if(idx > 0 && idx < MAX_BIZ && BizInfo[idx][bType] != 1 && BizInfo[idx][bType] != 2 && BizInfo[idx][bType] != 3 && BizInfo[idx][bType] != 4 && BizInfo[idx][bType] != 6 && BizInfo[idx][bType] != 7 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside a business.");
	
	if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buy [item]");
	if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products.");
	
	if(BizInfo[idx][bLevel] < bizlevel) return SendClientMessage(playerid, COLOR_GREY, "This business doesn't have this product yet.");
	
	if(BizInfo[idx][bType] == 1)// return SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the 24/7 Market!");
	{
	if(!strcmp(params, "speedometer", true))
	{
		if(GetPlayerMoney(playerid) >= price)
		{
			GivePlayerCash(playerid, -5000);
			PlayerInfo[playerid][pSpeedo] = 1;
			PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, COLOR_GRAD4, "Speedometer purchased.");
			SendClientMessage(playerid, COLOR_WHITE, "HINT: Type /speedo to use.");
			BizInfo[idx][bProducts] --;
			BizInfo[idx][bSold] ++;
			if(PlayerInfo[playerid][pDonateRank] >= 2)
			{
   				GivePlayerCash(playerid, -(80*price)/100);
   				BizInfo[idx][bMoney] += price;
				format(string, sizeof(string), "VIP: You have received 20 percent off this product. Instead of paying $%d, you paid $%d.", price, (80*price)/100);
		        SendClientMessageEx(playerid, COLOR_YELLOW, string);
	      	}
			else
			{
			    BizInfo[idx][bMoney] += price;
				GivePlayerCash(playerid, -price);
				}
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
			}
		}
		
	else if(BizInfo[idx][bType] == 3)// return SendClientMessage(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
	{		
	if(!strcmp(params, "vest", true))
	{
		if(GetPlayerMoney(playerid) >= price)
		{
			format(string, sizeof(string), "* %s has bought a vest for $%d.", GetPlayerNameEx(playerid), price);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			SetPlayerArmour(playerid, 100.00);
			BizInfo[idx][bProducts] --;
			BizInfo[idx][bSold] ++;
			if(PlayerInfo[playerid][pDonateRank] >= 2)
			{
				GivePlayerCash(playerid, -(80*price)/100);
				BizInfo[idx][bMoney] += price;
				format(string, sizeof(string), "VIP: You have received 20 percent off this product. Instead of paying $%d, you paid $%d.", price, (80*price)/100);
				SendClientMessageEx(playerid, COLOR_YELLOW, string);
			}
			else
			{
				BizInfo[idx][bMoney] += price;
				GivePlayerCash(playerid, -price);
				}
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
			}
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "   You are not at the Goverment Ammunation!");
		}
	}
	return 1;
}
I'm getting tired from that brackets... can someone give me a full tutorial of how using brackets in all conditions?
+REP
Reply


Messages In This Thread
Bracket of SendClientMessage - by Lidor124 - 06.02.2014, 09:07
Re: Bracket of SendClientMessage - by $Marco$ - 06.02.2014, 09:27
Re: Bracket of SendClientMessage - by Lidor124 - 06.02.2014, 09:32
Re: Bracket of SendClientMessage - by Sawalha - 06.02.2014, 09:59
Re: Bracket of SendClientMessage - by Lidor124 - 06.02.2014, 11:22
Re: Bracket of SendClientMessage - by Sawalha - 06.02.2014, 11:29
Re: Bracket of SendClientMessage - by Lidor124 - 06.02.2014, 12:08

Forum Jump:


Users browsing this thread: 1 Guest(s)