How can I bypass the 32 bit integer limit? (2,147,483,647)
#8

You can have 2 integer variables that you could join together, sort of anyways.
Name one variable HIGH and the other LOW (for example here).
When LOW exceeds 1 billion (1.000.000.000), substract 1 billion from it and add 1 to HIGH.

When LOW gets negative, add 1 billion to it and substract 1 from HIGH.

When displaying the money, you can simply print both values behind eachother
PHP код:
printf("%i%9i"HIGHLOW); 
The %9i is used to always make it 9 chars long and it adds leading zero's until it's 9 chars long.

But you are still limited to calculations up to 2 billion.

Mat I ask why your economy is that high?
What's the smallest amount of money being processed?
When your players could buy a drink, what does it cost?
What's the cheapest item on your server?

Your players may think they earn alot of money when they receive 100 million for a simple job, but when they buy a drink that costs 10 million as well, it still isn't alot of money.
It's still like the drink costs $10 and you earn $100, the ratio remains the same.

SAMP is 32-bit and you could use some workarounds but you're just making it harder than it needs to be.
You'll always be limited by 32-bit values.

Or you could use a string and manually perform calculations on that, then you can have calculations as high as you need it to be.
You could even display 128 character long values if you like and also perform calculations that long.
That would make your economy really big, I just can't grasp why you would need such high values.

Even the richest man on Earth doesn't have money that high.
Even if you add up all the money in the world, it isn't that high.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)