High numbers.
#1

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?
Reply
#2

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

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

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));
Reply
#5

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

let me know if it actually worked^^
(pm)
Reply
#7

Will do
Reply
#8

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

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]);
Reply
#10

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:/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)