/sellmats command problem
#1

Having another brainfart here.. I know it's right under my nose but I've been up all night and just want it pointed out before I pass out and forget about it xD


/sellmats sells 200 mats for $200
or
/sellmats sells 459 mats for $459

You get what I'm saying... Please remind my remaining battered brain cells what the problem is here x)

pawn Код:
if(strcmp("/sellmats", cmd, true) == 0)
        {
            if(PlayerInfo[playerid][pProfession] != 2 )
            {
                SendClientMessage(playerid, COLOR_RED, "Your character does not have the Arms Dealer profession!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[CMDINFO] - /sellmats [playerid] [price] [amount]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_SYSTEM, "[CMDINFO] - /sellmats [playerid] [price] [amount]");
                return 1;
            }
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    new price = strval(tmp);
                    if(giveplayerid == playerid)
                    {
                        SendClientMessage(playerid, COLOR_RED, "You cannot sell mats to yourself");
                        return 1;
                    }
                    if (ProxDetectorS(15.0, playerid, giveplayerid))
                    {
                        new amount = strval(tmp);
                        if(price < 1) { SendClientMessage(playerid, COLOR_RED, "You cannot sell mats for less then $1"); return 1; }
                        if(amount < 1) { SendClientMessage(playerid, COLOR_RED, "You cannot sell 0 mats to some one"); return 1; }
                        if(amount > PlayerInfo[playerid][pMats]) { SendClientMessage(playerid, COLOR_RED, "You don't have that many mats!"); return 1; }
                        OfferMatsPlayer[giveplayerid] = playerid;
                        OfferMatsPrice[giveplayerid] = price;
                        OfferMatsAmount[giveplayerid] = amount;
                        OfferedMats[giveplayerid] = 1;
                        format(string, sizeof(string), "%s has offered you %d mats for $%d (( /acceptmats ))", GetPlayerNameEx(playerid),amount, price);
                        SendClientMessage(giveplayerid, COLOR_ORANGE, string);
                        format(string, sizeof(string), "You offered %d mats to %s for $%d", amount, GetPlayerNameEx(giveplayerid), price);
                        SendClientMessage(playerid, COLOR_ORANGE, string);
                        return 1;
                    }
                }
            }
        }
Reply


Messages In This Thread
/sellmats command problem - by Phil_Cutcliffe - 11.02.2014, 14:37
Re: /sellmats command problem - by Don_Cage - 11.02.2014, 14:42
Re: /sellmats command problem - by Phil_Cutcliffe - 11.02.2014, 14:45
Re: /sellmats command problem - by Don_Cage - 11.02.2014, 14:58
Re: /sellmats command problem - by Phil_Cutcliffe - 11.02.2014, 17:24

Forum Jump:


Users browsing this thread: 1 Guest(s)