Formatting number - I will +rep
#1

Hi guys, how can I make that when I have 50000 cash it actually shows 50.000? Please help me I will +rep
Reply
#2

FIRSTLY We do NOT WORK ON REP!!!!!!!!

What do you mean by this :- how can I make that when I have 50000 cash it actually shows 50.000? ? ? ?
Reply
#3

I hope I helped:

pawn Код:
new cashtring[32];
            new cash= pData[id][pCash];
            new j = valstr(cashstring,cash);
            while(j >= 4) { j -= 3; strins(cashstring,",",j); }
I hope I helped, any feedback would be appreciated!.
Reply
#4

Doesn't work, it's still 50000, any other code?
Reply
#5

Use it as a float instead of integer
Reply
#6

pawn Код:
// I've no idea who made it.
stock FormatNumber(number) {
    new szString[13];
 
    format(szString,sizeof(szString), "%d", number);
 
    if (strlen(szString) < 4)
        return szString;
 
    new iPos = strlen(szString), iCount = 1;
 
    while (iPos) {
        if(iCount == 4) {
            iCount = 0;
            strins(szString,",",iPos,1);
            iPos ++;
        }

        iCount ++;
        iPos --;
    }
    return szString;
}
Reply
#7

EDIT: Doesn't work, it says 50$ instead of 25,000$
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)