SA-MP Forums Archive
What the hell 0_0?.. Weird problem - 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: What the hell 0_0?.. Weird problem (/showthread.php?tid=300893)



What the hell 0_0?.. Weird problem - bartje01 - 02.12.2011

Hey all. I've got a really strange problem and I don't know where I have to look in my script.
Once my variable has reached 60000 it reduces to like 5000 or near that. I just can't get more then 60.000
I'm using rBits. This is how I store my cash.

Bit16: g_Cash <MAX_PLAYERS>,

When I use this cmd:

pawn Код:
COMMAND:cash(playerid,params[])
{
    Bit16_Set(g_Cash,playerid,Bit16_Get(g_Cash,playerid)+10000);
    return 1;
}
It works till I have 60.000. Then it goes down to 0-5000 or something.
What could it be?


Re: What the hell 0_0?.. Weird problem - Vince - 02.12.2011

Overflow most likely. Why don't you use a regular 32 bit integer? I've never understood the usefulness of these rBits, because you don't need to use them for the saved memory space. A 16 bit integer can't store a number greater than 32767, by the way.


Re: What the hell 0_0?.. Weird problem - bartje01 - 02.12.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
Overflow most likely. Why don't you use a regular 32 bit integer? I've never understood the usefulness of these rBits, because you don't need to use them for the saved memory space. A 16 bit integer can't store a number greater than 32767, by the way.
How to make it to a 32bit?
Bit32: g_Cash <MAX_PLAYERS>,
will not work xD


Re: What the hell 0_0?.. Weird problem - Vince - 02.12.2011

pawn Код:
new g_Cash[MAX_PLAYERS];
<_<

Also, I was only partially correct in my previous post. A signed 16-bit integer can hold a maximum value of 32767, but an unsigned 16-bit integer can hold a maximum value of 65535.


Re: What the hell 0_0?.. Weird problem - bartje01 - 02.12.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
pawn Код:
new g_Cash[MAX_PLAYERS];
<_<

Also, I was only partially correct in my previous post. A signed 16-bit integer can hold a maximum value of 32767, but an unsigned 16-bit integer can hold a maximum value of 65535.
Oh, I didn't know that was 32 bit :P. Thankyou really much.