[SOLVED] $10000 > $10.000
#1

How can i make a script that change intiger into money notation?
I tryed to make this, but it returns nothing:
pawn Код:
stock inttomoney(money)
{
    new string2[256];
    new string[256];
    format(string,sizeof(string),"%i",money);
    format(string2,sizeof(string2),"%i",money);
    new lang = strlen(string2);
    new totallang = lang+(lang/3);
    new idx=lang;
    for(new i;i<((lang/3)-1);i++)
    { //make space free for points
      new idx2;
      while(idx2 < lang)
      {
            string[idx2-1-(lang/3)] = string2[idx2];
        idx2++;
      }
      string[i] = ' ';
    }
    for(new s=1;s<totallang;)
    {
        s*=3;
        idx = lang-s;
        if((lang-s) < 3)
        {
            for(new i=lang-s;i<s;i--)
            {
                string[idx-i] = string2[idx-i];
            }
            string[idx] = '.';
        } else
        {
            for(new i=3;i<0;i--)
            {
                string[idx-i] = string2[idx-i];
            }
            string[idx] = '.';
        }
    }
    return string;
}
Reply


Messages In This Thread
[SOLVED] $10000 > $10.000 - by GTAguillaume - 20.12.2009, 15:16
Re: [HELP] $10000 > $10.000 - by Marcel - 20.12.2009, 15:24
Re: [SOLVED] $10000 > $10.000 - by GTAguillaume - 20.12.2009, 15:54

Forum Jump:


Users browsing this thread: 2 Guest(s)