27.08.2010, 13:59
How would i format cash to say like : 1.500.454.435 etc?
I saw on useful functions section a function named NiceMoney, but this didn't work ?
heres the NiceMoney function:
Also tested it with a loop:
I saw on useful functions section a function named NiceMoney, but this didn't work ?
heres the NiceMoney function:
pawn Код:
NiceMoney(amount, sep[] = ".")
{
new
money[16],
negativ = 0;
if(amount < 0) negativ = 1;
format(money, sizeof(money), "%i", amount);
new
lenght = strlen(money);
while((lenght -= 3) > negativ) strins(money, sep, lenght);
return money;
}
pawn Код:
new Test[5];
for(new i; i < sizeof(Test); i++)
{
Test[i] = rand(50000,150000);
printf("%f",NiceMoney(Test[i]));
}