27.06.2016, 22:45
Alright so the problem is quite simple, im trying to use %.2f combined with decimal point, altho theres someting wrong with this
My cash at the moment is
383100.00 (yes I am using cash as a float)
and the print is
38311,00,00 (not sure if the last diggits are .00 or ,00 since the textdraw font is glitched atm, trying to get it to work with , and .)
Well, I am trying to get it to look like this
383,100.00$
the .00 would of course get from .2f (for example it can be .50$ etc) all in all, cents.
the code is
EDIT v1: I justed tested it as %f instead of %.2f and I got the results of
3831,00.0000000$
Almost correct. Just gotta get it to be
381,100.00$
My cash at the moment is
383100.00 (yes I am using cash as a float)
and the print is
38311,00,00 (not sure if the last diggits are .00 or ,00 since the textdraw font is glitched atm, trying to get it to work with , and .)
Well, I am trying to get it to look like this
383,100.00$
the .00 would of course get from .2f (for example it can be .50$ etc) all in all, cents.
the code is
PHP код:
stock DecimalPoint(Float:money)
{
new str[16];
if(money >= 0)
{
format(str, sizeof(str), "%.2f$", money);
if(1000 <= money < 10000) strins(str, ",", 2, sizeof(str));
else if(10000 <= money < 100000) strins(str, ",", 3, sizeof(str));
else if(100000 <= money < 1000000) strins(str, ",", 4, sizeof(str));
else if(1000000 <= money < 10000000) { strins(str, ",", 2, sizeof(str)); strins(str, ",", 6, sizeof(str)); }
else if(10000000 <= money < 100000000) { strins(str, ",", 3, sizeof(str)); strins(str, ",", 7, sizeof(str)); }
else if(100000000 <= money < 1000000000) { strins(str, ",", 4, sizeof(str)); strins(str, ",", 8, sizeof(str)); }
else if(money >= 1000000000) { strins(str, ",", 2, sizeof(str)); strins(str, ",", 6, sizeof(str)); strins(str, ",", 10, sizeof(str)); }
}
else
{
format(str, sizeof(str), "-%.2f$", money-(money*2));
if(-1000 >= money > -10000) strins(str, ",", 3, sizeof(str));
else if(-10000 >= money > -100000) strins(str, ",", 4, sizeof(str));
else if(-100000 >= money > -1000000) strins(str, ",", 5, sizeof(str));
else if(-1000000 >= money > -10000000) { strins(str, ",", 3, sizeof(str)); strins(str, ",", 7, sizeof(str)); }
else if(-10000000 >= money > -100000000) { strins(str, ",", 4, sizeof(str)); strins(str, ",", 8, sizeof(str)); }
else if(-100000000 >= money > -1000000000) { strins(str, ",", 5, sizeof(str)); strins(str, ",", 9, sizeof(str)); }
else if(money <= -1000000000) { strins(str, ",", 3, sizeof(str)); strins(str, ",", 7, sizeof(str)); strins(str, ",", 11, sizeof(str));}
}
return str;
}
3831,00.0000000$
Almost correct. Just gotta get it to be
381,100.00$