What the hell 0_0?.. Weird problem
#1

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

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

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)