Bracket of SendClientMessage
#4

pawn Код:
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;
}
Here's the code, anything missed or any mistake inside it?
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: 2 Guest(s)