I've searched/debugged a bit and the problem is most likely a loss of precision double -> float. Let me explain.
The bug is not from AMXX, all the native does is returning (int)ptr->value, so the float value converted to an integer.
This float value is set when you register a cvar, in the engine, using Q_atof(). This function itself works fine. The functions looks like :
PHP Code:
float Q_atof (char *str)
{
double val;
int sign;
int c;
int decimal, total;
if (*str == '-')
{
sign = -1;
str++;
}
else
sign = 1;
val = 0;
//
// check for hex
//
if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X') )
{
str += 2;
while (1)
{
c = *str++;
if (c >= '0' && c <= '9')
val = (val*16) + c - '0';
else if (c >= 'a' && c <= 'f')
val = (val*16) + c - 'a' + 10;
else if (c >= 'A' && c <= 'F')
val = (val*16) + c - 'A' + 10;
else
return val*sign;
}
}
//
// check for character
//
if (str[0] == '\'')
{
return sign * str[1];
}
//
// assume decimal
//
decimal = -1;
total = 0;
while (1)
{
c = *str++;
if (c == '.')
{
decimal = total;
continue;
}
if (c <'0' || c > '9')
break;
val = val*10 + c - '0';
total++;
}
if (decimal == -1)
return val*sign;
while (total > decimal)
{
val /= 10;
total--;
}
return val*sign;
}
The problem is it returns a float, when you're working with double. The value is right when it's about to be returned, but it's lost precision once it has been converted to float.
I don't know much why and how such things are handled but the problem is that.
Since from the engine, you can't fix directly. It's possible to fix amxmodx by overwriting this value using atof() from the string, in register_cvar native, it will work.
Another way is to use a common way where you use the letters as flags then you could use read_flags() to get the bits sum from the letters.
I don't remember seeing a plugin dealing with such big number in a cvar.
__________________