#1

Why this isn't working?

pawn Код:
if(amount > Pdrug[gpid][Weed])
            {
                Pdrug[gpid][Weed] -= amount;
                format(string, sizeof(string), "* %s took %d gram(s) of weed from you", sendername, amount);
                SendClientMessage(gpid, 0x33CCFFAA, string);
            }
            else
            {
                SendClientMessage(playerid, -1, "{FF6A22}INFO:{FFFFFF} That player doesn't have so much weed");
            }
I can still take away drugs from player even if he has less drugs than amount I want to take.. ?
Reply
#2

Well yes, because you have your logic inverted. Try taking away less than their amount and you will see it doesn't work.
Reply
#3

if(amount > Pdrug[gpid][Weed])

To

if(amount < Pdrug[gpid][Weed]) ?

Not at home right now.
Reply
#4

pawn Код:
if(amount < Pdrug[gpid][Weed])
{
    Pdrug[gpid][Weed] -= amount;
    format(string, sizeof(string), "* %s took %i gram(s) of weed from you", sendername, amount);
    SendClientMessage(gpid, 0x33CCFFAA, string);
}
else
{
    SendClientMessage(playerid, -1, "{FF6A22}INFO:{FFFFFF} That player doesn't have so much weed");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)