SA-MP Forums Archive
Depositing a negative amount? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Depositing a negative amount? (/showthread.php?tid=243980)



Depositing a negative amount? - Antonio [G-RP] - 25.03.2011

How can I stop players from depositing a negative amount?

(/deposit -50) for eg.

I've tried many things.


Re: Depositing a negative amount? - Medal Of Honor team - 25.03.2011

pawn Код:
if(GetPlayerMoney(playerid) < 0)
{
    SendClientMessage(playerid, COLOR, "You can't deposit the cash you don't have");
    return true;
}



Re: Depositing a negative amount? - antonio112 - 25.03.2011

You can use:

pawn Код:
if(params[ 0 ] <= 0 )
     return SendClientMessage(playerid, -1, "You can`t deposit negative amount of money.");
Where params[ 0 ] = the amount of money you want to deposit.

ps: Medal, he means how can disable to deposit - amount of money. If you don`t disable that, it`s like you take money out of the bank with /deposit. For example, if you have 0 amount in your bank and do /deposit -50, you`ll end up with -50 in bank and +50 in your hand.


Re: Depositing a negative amount? - Serbish - 25.03.2011

Quote:
Originally Posted by Medal Of Honor team
Посмотреть сообщение
pawn Код:
if(GetPlayerMoney(playerid) < 0)
{
    SendClientMessage(playerid, COLOR, "You can't deposit the cash you don't have");
    return true;
}
Still, if he has more than 0 $ he will be able to deposit -50 $.


Re: Depositing a negative amount? - Antonio [G-RP] - 25.03.2011

Both of those, do not work sadly.

The player can still do /deposit -50


Re: Depositing a negative amount? - antonio112 - 25.03.2011

Give us your command please. It works for me, just tested it out.


Re: Depositing a negative amount? - Mauzen - 25.03.2011

antonio112's code works for sure, you just have to use it correctly. Be sure you replace params[0]


Re: Depositing a negative amount? - Antonio [G-RP] - 25.03.2011

Oh, alright. I thought I had something like that earlier, but I'll give it a try. Thanks.