/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
#2

pawn Код:
new amount = strval(tmp);
gives you 10 mats - 10 dollars
since price is

pawn Код:
new price = strval(tmp);
Reply
#3

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
pawn Код:
new amount = strval(tmp);
gives you 10 mats - 10 dollars
since price is

pawn Код:
new price = strval(tmp);
Could you remind me what I'm supposed to do to my amount please? I'm really low on thinking power right this minute! I know that's the problem I'm just so pooped I can't remember the layout of what I'm trying to achieve.
Reply
#4

Check for

pawn Код:
OfferMatsPrice
You can do it like this

pawn Код:
GivePlayerMoney(playerid, amount*X)
PlayerInfo[playerid][pMats] -= amount;
Example: GivePlayerMoney(playerid, ammount*10)
will give ammount of mats x 10 which means if you /sellmats 10 you get 100$
Reply
#5

Nah that's totally not what I ment pal but thankyou any way. I sorted it. Just a simple brain fart when I was tired.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)