Depositing a negative amount?
#1

How can I stop players from depositing a negative amount?

(/deposit -50) for eg.

I've tried many things.
Reply
#2

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

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.
Reply
#4

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 $.
Reply
#5

Both of those, do not work sadly.

The player can still do /deposit -50
Reply
#6

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)