Float money
#1

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:

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;
}
Also tested it with a loop:
pawn Код:
new Test[5];
    for(new i; i < sizeof(Test); i++)
    {
        Test[i] = rand(50000,150000);
        printf("%f",NiceMoney(Test[i]));
    }
Reply


Messages In This Thread
Float money - by Cameltoe - 27.08.2010, 13:59
Re: Float money - by Jeffry - 27.08.2010, 14:14
Re: Float money - by Cameltoe - 27.08.2010, 14:21
Re: Float money - by woot - 27.08.2010, 14:30
Re: Float money - by Cameltoe - 27.08.2010, 14:39
Re: Float money - by Jeffry - 27.08.2010, 14:49
Re: Float money - by Cameltoe - 27.08.2010, 15:14
Re: Float money - by Slice - 27.08.2010, 15:17
Re: Float money - by Jeffry - 27.08.2010, 15:38

Forum Jump:


Users browsing this thread: 2 Guest(s)