[REP++] Money over 2,000,000,000$
#1

If i have more than 2,000,000,000$ in hand or bank for example money goes with -.
How can i increase this limit? I know that some servers did.
Thanks!
Reply
#2

You cannot because a 32 bit integer cannot store larger numbers. Maybe it's time to rethink your server economy instead.

The greatest number that can be stored in a 32 bit integer is:
Код:
01111111111111111111111111111111‬
equivalent to 2,147,483,647‬
The most significant bit (left most bit) stores whether the number is positive (0) or negative (1). Adding another digit to the value above makes the digits roll around and produce:
Код:
10000000000000000000000000000000
equivalent to -2,147,483,648‬
Reply
#3

I think the solution is to make 1-2 more variables for money for sum and show, not to sore in a variable.
Reply
#4

Quote:
Originally Posted by buburuzu19
Посмотреть сообщение
If i have more than 2,000,000,000$ in hand or bank for example money goes with -.
How can i increase this limit? I know that some servers did.
Thanks!
Currently, the only possible method:
https://sampforum.blast.hk/showthread.php?tid=598933
Reply
#5

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
Currently, the only possible method:
https://sampforum.blast.hk/showthread.php?tid=598933
How can i use it? Can you give me an example of storing and showing in a string, for example pVar[playerid][pMoney] = ... ?
Thanks !
Reply
#6

for example, for use by the bank

PHP код:
pVar[playerid][pMoney] - your variable suffix
pVar
[playerid][pMoneyLY] - your variable prefix
//adding money to the bank
UpdateLY(pVar[playerid][pMoneyLY], pVar[playerid][pMoney], amount); //<-- set your amount
GivePlayerMoney(playerid,-amount);
//the payment from the bank
if(IsValueContainLY(pVar[playerid][pMoneyLY], pVar[playerid][pMoney], amount)){ //<-- set your amount
    
UpdateLY(pVar[playerid][pMoneyLY], pVar[playerid][pMoney], -amount);
    
GivePlayerMoney(playerid,amount);
} else {
    
//you do not have enough money
}
//The amount of money in bank
new mymoney[LY_STRING_LEN], buffer[128];
GetLYString(pVar[playerid][pMoneyLY], pVar[playerid][pMoney], mymoney);
format(buffer,sizeof buffer,"You money in bank: %s",mymoney);
SendClientMessage(playerid,-1,buffer); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)