MAX Cash Storage!
#1

Hello, i need help with max cash storage.

Like, making the max house storage to 10m to the players can't store more then 10m in it.

In my case, its wallet. I have maximum storage:25m but still players can store more then 25m by doing it in different way. i need to fix it

Im saving wallet cash using y_Ini.

here's my code
PHP код:
// on player text
                
if (GetPlayerCash(playerid) < Option)
        {
        
format(stringsizeof(string), "You Don't Have $%d To Put Into Storage.",Option);
        
SendClientMessage(playeridCOLOR_ERRORstring);
        return 
1;
        }
          if (
Option >= 25000000)
        {
        
SendClientMessage(playeridCOLOR_ERROR"You Can't Store More Then 25m In Your Wallet.");
        return 
1;
        }
          if(
wInfo[playerid][MoneyWallet] > 24999999)
        {
        
format(stringsizeof(string), "You Can't Store More Then 25 In Your Wallet.");
        
SendClientMessage(playeridCOLOR_ERRORstring);
        return 
1;
        }
        if(
wInfo[playerid][MoneyWallet] < 24999999)
        {
        
GiveCash(playerid, - Option);
        
wInfo[playerid][MoneyWallet] = wInfo[playerid][MoneyWallet] + Option;
        
format(stringsizeof(string), "You Have Placed $%d In Storage. Total Wallet Storage: $%d.",Option,                               wInfo[playerid][MoneyWallet]);
        
SendClientMessage(playeridCOLOR_SERVER_HELP_MSGstring);
        
HideTextDrawMenu(playerid);
        
Wallet_Save(playerid);
        
Wallet_Load(playerid);
        }else{
        
SendClientMessage(playeridCOLOR_ERROR"You Can't Store More Then 10m In Your Wallet.");
        } 
But there's a problem in this code. More then 25m can be stored.

HOW: well it says "You can't" store more then 25m in wallet when someone stores 25m at first attempt

But if some one store 24m first and then 2m, then it will be 26m in wallet.

How can i fix it
Reply
#2

You should check if they will have more than 25m with their current amount in the wallet and the amount they want to deposit. Something like this:
pawn Код:
if(PlayerInfo[playerid][pWallet] + option > 25000000) return SendClientMessage...
Reply
#3

I'll try it, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)