SA-MP Forums Archive
High numbers. - 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)
+--- Thread: High numbers. (/showthread.php?tid=294491)



High numbers. - ikkentim - 01.11.2011

Hi samp-people

I got an problem In my script:
new BankCash[MAX_PLAYERS];

But people seem to reach the max int dolars(about 2.000.000.000)
is there a way to make it an bigint or solve my problem with an second variable?


Re: High numbers. - SuperViper - 01.11.2011

If you really need that much money for one player, I suggest you do something about that instead of scripting something to give them even more. You can't do this with one variable as they can only hold a value of 2,147,483,647 but you can of course use multiple variables.


Re: High numbers. - ikkentim - 01.11.2011

So there is't an like a C bigint, well then I have to use multiple variables.
I got one more question then, how can i show how much monew someone has when i can't go past that number?


Re: High numbers. - Sascha - 01.11.2011

maybe like this (not sure if it works):
pawn Код:
new string[1024]; //not sure about the string length
format(string, sizeof(string), "Money: %d", strval(val1) + strval(val2));



Re: High numbers. - ikkentim - 01.11.2011

If that would work it would be awesome will test that tomorrow, thank you!


Re: High numbers. - Sascha - 01.11.2011

let me know if it actually worked^^
(pm)


Re: High numbers. - ikkentim - 01.11.2011

Will do


Re: High numbers. - ikkentim - 02.11.2011

It didn't work ;( Anyone got another solution?


Re: High numbers. - cessil - 02.11.2011

I can't think straight at the moment to come up with an example script but basically you'd have BankCash split into an array which hold a maximum of ~2billion each cell, then when it subtracts it tries subtracting from the highest index and works its way down, and when it adds cash it'll add from the lowest index and try filling up, when one cell equals 2billion it'll go into the next one.

so if you had 1,000 it'd be
BankCash[playerid][0] = 1000
BankCash[playerid][1] = 0
BankCash[playerid][2] = 0
BankCash[playerid][3] = 0

if you had 2,300,000,000 it'd be
BankCash[playerid][0] = 2000000000
BankCash[playerid][1] = 300000000
BankCash[playerid][2] = 0
BankCash[playerid][3] = 0

and to display it you could look at how many of them are full, if the first is full then they have over 2 billion

pawn Код:
if(BankCash[playerid][0] == MAX_BANK_LIMIT && BankCash[playerid][1] < MAX_BANK_LIMIT) format(string,sizeof(string),"$2.%d Billion",BankCash[playerid][1]);



Re: High numbers. - ikkentim - 02.11.2011

Thanks for the responses plug works and cessils too, I think i will use cessils one since i think it is faster

@****** i know:/ people get 200$ when robbing a shop, and about 4000$ when robbing a player, about 350$ / arrest and about 500$ / job, but some people seem to like robbinng and rob 3000 shops, they get 0.1% interest each ig day:/