Format Cash - 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: Format Cash (
/showthread.php?tid=580078)
Format Cash -
Sc0pion - 02.07.2015
Fixed!
Re: Format Cash -
Youssef221 - 02.07.2015
pawn Код:
stock Comma(numbers)
{
new temp[24],counter = -1;
valstr(temp,numbers);
for(new i = strlen(temp);i > 0; i--)
{
counter++;
if(counter == 3)
{
strins(temp,",",i);
counter = 0;
}
}
return temp;
}
NOTE: it's by Gamer931215.
Re: Format Cash -
Sc0pion - 02.07.2015
Fixed!
Re: Format Cash -
Youssef221 - 02.07.2015
If on filterscripts, yes.
AW: Format Cash -
Kaliber - 02.07.2015
This will not work, if you use negative values.
So write it like this:
PHP код:
stock comma(money) //© by Kaliber
{
new str[24],i;valstr(str,money),i=(money > 0) ? strlen(str)-3 : strlen(str)-4;
for(; i>0; i-=3) strins(str,".",(money > 0) ? i : i+1,24);
return str;
}
Re: Format Cash -
Sc0pion - 02.07.2015
Fixed!
AW: Re: Format Cash -
Kaliber - 02.07.2015
Quote:
Originally Posted by Sc0pion
Not working bro.
|
Show us the code ... how you used it?
Re: AW: Re: Format Cash -
Sc0pion - 02.07.2015
Fixed!
AW: Format Cash -
Kaliber - 02.07.2015
1. Use my function...
2. Yes but you should show us the code, where you use this function
Re: Format Cash -
Threshold - 02.07.2015
pawn Код:
stock Comma(numbers)
{
new temp[24];
valstr(temp, numbers);
for(new i = strlen(temp) - 3; i > 0; i -= 3)
{
if(temp[i - 1] != '-') strins(temp, ",", i);
}
return temp;
}
Not that hard, is it?