[Include] [INC] FormatMoney()
#9

Quote:
Originally Posted by BlueRey

fix: http://bluerey.pastebin.com/e82A5hfU
pawn Код:
stock FormatMoney(Float:amount,delimiter[2]=",")
{
    #define MAX_MONEY_STRING 16
    new txt[MAX_MONEY_STRING];
    format(txt,MAX_MONEY_STRING,"%d",floatround(amount));
    new l = strlen(txt);
    if(amount < 0)
    {
         if(l >= 5) strins(txt,delimiter,l-3);
        if(l >= 8) strins(txt,delimiter,l-6);
        if(l >= 11) strins(txt,delimiter,l-9);
    }
    else
    {
        if(l >= 4) strins(txt,delimiter,l-3);
        if(l >= 7) strins(txt,delimiter,l-6);
        if(l >= 10) strins(txt,delimiter,l-9);
    }
    return txt;
}
And what exactly did you "fix"? did you test your code? I tested mine, it works fine and I posted my results... .
Reply


Messages In This Thread
[INC] FormatMoney() - by mick88 - 19.06.2010, 18:31
Re: [INC] FormatMoney() - by SloProKiller - 19.06.2010, 18:36
Re: [INC] FormatMoney() - by Calgon - 19.06.2010, 18:38
Re: [INC] FormatMoney() - by mick88 - 19.06.2010, 20:28
Re: [INC] FormatMoney() - by Grim_ - 19.06.2010, 21:45
Re: [INC] FormatMoney() - by VinceQc - 19.06.2010, 22:19
Re: [INC] FormatMoney() - by mick88 - 19.06.2010, 22:43
Re: [INC] FormatMoney() - by BlueRey - 20.06.2010, 01:24
Re: [INC] FormatMoney() - by mick88 - 20.06.2010, 15:37
Re: [INC] FormatMoney() - by BlueRey - 22.06.2010, 05:27

Forum Jump:


Users browsing this thread: 3 Guest(s)