SA-MP Forums Archive
Needing money translate function - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Needing money translate function (/showthread.php?tid=350743)



Needing money translate function - Nightmare[TR] - 13.06.2012

Hi mates,i need a func. that translates entered integer value to money,example : entry: 50000,return : 50.000
I mean,i want something that can write dots


Re: Needing money translate function - Nightmare[TR] - 13.06.2012

O.K,i found it.Credits goes to RyDeR.
Код:
stock convertNumber(value)
{
   new
      string[24]
   ;
   format(string, sizeof(string), "%d", value);
   
   for(new i = (strlen(string) - 3); i > (value < 0 ? 1 : 0) ; i -= 3)
   {
       strins(string[i], ".", 0);
   }
   return string;
}