20.12.2009, 15:16
How can i make a script that change intiger into money notation?
I tryed to make this, but it returns nothing:
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;
}