SA-MP Forums Archive
limit - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: limit (/showthread.php?tid=528316)



limit - Lajko1 - 27.07.2014

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.. ?


Re: limit - Vince - 27.07.2014

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


Re: limit - Lajko1 - 27.07.2014

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

To

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

Not at home right now.


Re: limit - Juvanii - 27.07.2014

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");
}