Alright so the problem is quite simple, im trying to use %.2f combined with decimal point, altho theres someting wrong with this
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 .)
the .00 would of course get from .2f (for example it can be .50$ etc) all in all, cents.
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;
}
Almost correct. Just gotta get it to be
".
use Float for a currency. If you want your currency to be rouded to cents, store it as an integer multiple of a cent.