ValStr not working with "2130706433" (Integer of an IP), does it have a limit?
#2

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:

pawn Код:
format(str, sizeof (str), "%03d.%03d.%03d.%03d", ip >>> 24, ip >>> 16 & 0xFF, ip >>> 8 & 0xFF, ip & 0xFF);
Or drop the "03"s and get it variable length - smaller to store, slightly harder to read:

pawn Код:
ip = strval(str) << 24 | strval(str[4]) << 16 | strval(str[8]) << 8 | strval(str[12]);
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.
Reply


Messages In This Thread
ValStr not working with "2130706433" (Integer of an IP), does it have a limit? - by [HLF]Southclaw - 14.06.2012, 12:35
Re: ValStr not working with "2130706433" (Integer of an IP), does it have a limit? - by Y_Less - 14.06.2012, 12:58
Re: ValStr not working with "2130706433" (Integer of an IP), does it have a limit? - by [HLF]Southclaw - 14.06.2012, 13:25
Re: ValStr not working with "2130706433" (Integer of an IP), does it have a limit? - by Y_Less - 14.06.2012, 13:28

Forum Jump:


Users browsing this thread: 1 Guest(s)