How can I do from this: $1000 to this: $1,000. - 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: How can I do from this: $1000 to this: $1,000. (
/showthread.php?tid=360400)
How can I do from this: $1000 to this: $1,000. -
Dokins - 17.07.2012
How is it that you can do that? i.e like $100000 > $100,000
Add in a comma.
Re: How can I do from this: $1000 to this: $1,000. -
MP2 - 17.07.2012
https://sampforum.blast.hk/showthread.php?tid=184328
Respuesta: How can I do from this: $1000 to this: $1,000. -
Bu11Sh0t - 17.07.2012
Credits to Ryder (I think)
pawn Код:
stock convertNumber(iValue, iDelim[2] = ",", szNum[15] = "", iSize = sizeof(szNum)) {
format(szNum, iSize, "%d", iValue < 0 ? -iValue : iValue);
for(new i = strlen(szNum) - 3; i > 0; i -= 3) {
strins(szNum, iDelim, i, iSize);
}
if(iValue < 0) {
strins(szNum, "-", 0, iSize);
}
return szNum;
}
pawn Код:
public OnGameModeInit()
{
convertNumber(500000);//500,000
return 1;
}
Re: How can I do from this: $1000 to this: $1,000. -
Dokins - 17.07.2012
Quote:
Originally Posted by MP2
|
Hmm, I'm not sure that's what that does?
Re: Respuesta: How can I do from this: $1000 to this: $1,000. -
Dokins - 17.07.2012
Quote:
Originally Posted by Bu11Sh0t
Credits to Ryder (I think)
pawn Код:
stock convertNumber(iValue, iDelim[2] = ",", szNum[15] = "", iSize = sizeof(szNum)) { format(szNum, iSize, "%d", iValue < 0 ? -iValue : iValue);
for(new i = strlen(szNum) - 3; i > 0; i -= 3) { strins(szNum, iDelim, i, iSize); } if(iValue < 0) { strins(szNum, "-", 0, iSize); } return szNum; }
pawn Код:
public OnGameModeInit() { convertNumber(500000);//500,000 return 1; }
|
Thank you! REP +.