Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
aRoach - 27.01.2012
Well, I'm glad that I've helped you to find a 'problem', I think...
So, for a moment ( until you will fix SSCANF ) I will delete that part of code, because it's running without it too...
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Blacklite - 29.06.2012
An optional currency sign would be rather useful. You can't just do this:
pawn Код:
format(string, sizeof(string), "$%s", NumberFormat(-123456789));
Because you'll get numbers like:
$-100,000,000
The - should be right at the beginning. I know it's not hard to make a function that simply inserts a dollar sign after the - (or at the beginning of the string if no - is there), but I feel as though a function called FormatNumber should also be able to format the number into a currency. Would be more efficient than creating another tack-on function too.
Love your work!
Re : formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Islam_Gerland_99 - 11.07.2012
Good Format numbers For SACNR Blacklite !!!
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
GoldZoroGrab - 01.07.2013
Hey guys...
I Added the include to my gamemode
pawn Код:
new money;
//money is my 10% from my hand money but see this error
new amount = money*10/100;
format(str2,sizeof(str2),"%d",FormatNumber(amount));//here i did
SendClientMessage(playerid, COLOR_WEAKBLUE, str2);
Error: C:\Users\HP\Desktop\Files\Server\pawno\include\for matnumber.inc(113) : error 020: invalid symbol name ""
Line 113 in include: else if ( iTag == tagof( hex: ) || iTag == tagof( Hex: ) )
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Slice - 01.07.2013
What other include files do you use?
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
GoldZoroGrab - 01.07.2013
Quote:
Originally Posted by Slice
What other include files do you use?
|
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <YSI\y_ini>// this is amazing for save Files
#include <foreach>
#include <streamer>
#include <AirBreak>
#include <moneyhax>
#include <dini>
#include <core>
#include <vplate>
#include <formatnumber>
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
GoldZoroGrab - 01.07.2013
Quote:
Originally Posted by ******
Pretty sure this was determined to be a conflict with sscanf (see previous posts).
|
#define hex:%0;unformat(_:EXTRZ:EXTRX:%1); %0;unformat(_:EXTRZ:EXTRX:%1);
where should i put this bro?
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Reboma - 30.01.2014
I fixed a small bug: when i format -100000 it will return: -,100,000
The fix:
Replace this line in formatnumber.inc
With this:
pawn Код:
if ( ++s_iSepPos == 3 && s_szReturn[s_iChar-1] != '-' )
Test script:
pawn Код:
new i = 0;
while(i < 210000000)
{
i += random(9) + 1;
printf("formatted: %s", FormatNumber(i, 0, ','));
printf("formatted: %s", FormatNumber(i * -1, 0, ','));
i *= 10;
}
Output:
Код:
[17:08:51] formatted: 4
[17:08:51] formatted: -4
[17:08:51] formatted: 46
[17:08:51] formatted: -46
[17:08:51] formatted: 469
[17:08:51] formatted: -,469 <------- ???
[17:08:51] formatted: 4,694
[17:08:51] formatted: -4,694
[17:08:51] formatted: 46,945
[17:08:51] formatted: -46,945
[17:08:51] formatted: 469,455
[17:08:51] formatted: -,469,455 <------- ???
[17:08:51] formatted: 4,694,558
[17:08:51] formatted: -4,694,558
[17:08:51] formatted: 46,945,588
[17:08:51] formatted: -46,945,588
Fixed version:
Код:
[17:09:05] formatted: 3
[17:09:05] formatted: -3
[17:09:05] formatted: 31
[17:09:05] formatted: -31
[17:09:05] formatted: 314
[17:09:05] formatted: -314 <------- fixed
[17:09:05] formatted: 3,146
[17:09:05] formatted: -3,146
[17:09:05] formatted: 31,461
[17:09:05] formatted: -31,461
[17:09:05] formatted: 314,615
[17:09:05] formatted: -314,615 <------- fixed
[17:09:05] formatted: 3,146,158
[17:09:05] formatted: -3,146,158
[17:09:05] formatted: 31,461,582
[17:09:05] formatted: -31,461,582
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Smileys - 30.01.2014
awesome work.
******, it fixed the problem, I was stuck with it aswell, thanks for giving the fix
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
minhducc - 08.08.2014
\pawno\include\formatnumber.inc(112) : error 020: invalid symbol name ""
![Huh?](images/smilies/confused.gif)
![Huh?](images/smilies/confused.gif)
?? What is This
Re : Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
anou1 - 13.08.2014
Quote:
Originally Posted by minhducc
\pawno\include\formatnumber.inc(112) : error 020: invalid symbol name "" ![Huh?](images/smilies/confused.gif) ![Huh?](images/smilies/confused.gif) ?? What is This
|
Same problem here
Re : formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
anou1 - 13.08.2014
"#define hex:%0;unformat(_:EXTRZ:EXTRX:%1); %0;unformat(_:EXTRZ:EXTRX:%1);"
Problem solved, thank you.
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
KayJ - 23.09.2014
good include
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Crayder - 25.09.2014
Ehh hmm... I'd like to point out that it rounds floats DOWN, instead of up
![Sad](images/smilies/sad.gif)
...
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Kar - 29.03.2016
Slice, I believe this include needs a little love.
- Fix negative numbers.
- Hex: missing from xVariable tag specifications.
Also curious, shouldn't you only search for decimals if its a float? (s_iDecimalPos = strfind( s_szReturn, "." )
EDIT: I went ahead and did my own fixes.
https://gist.github.com/Kar2k/bfb0ea...91b9/revisions
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Crayder - 29.03.2016
I meant to ask before, but... Why does this support the following tags: Text3D, Menu, Text, DB, DBResult, and File?
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
Slice - 29.03.2016
Quote:
Originally Posted by Crayder
I meant to ask before, but... Why does this support the following tags: Text3D, Menu, Text, DB, DBResult, and File?
|
I think the reason was to make it easy to make a generic "dump this number" function, which supported most common tags one would need to debug.
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) -
rockys - 23.12.2018
invalid download link