14.06.2012, 12:58
And yes it does have a limit because although IPs and cells are both 32bit, IPs are unsigned and cells are signed. Plus I think there's a bug in valstr with long numbers. Just use format or don't save in an obscure format.
Edit: I should say "try" format, no idea if it will work any better. Or write a custom function to do the job. Or:
Or drop the "03"s and get it variable length - smaller to store, slightly harder to read:
That being the other problem - even if you can write a single number I'm not sure you can read it due to the reverse of the same problems.
Edit: I should say "try" format, no idea if it will work any better. Or write a custom function to do the job. Or:
pawn Код:
format(str, sizeof (str), "%03d.%03d.%03d.%03d", ip >>> 24, ip >>> 16 & 0xFF, ip >>> 8 & 0xFF, ip & 0xFF);
pawn Код:
ip = strval(str) << 24 | strval(str[4]) << 16 | strval(str[8]) << 8 | strval(str[12]);