Seperate numbers by comma?
#1

Hello, i am trying to seperate the moneys in /stats by commas, i have made this but for some reason it doesnt work, i hope that someone can help me

pawn Код:
new totalwealth;
        totalwealth = PlayerInfo[targetid][pCash]+PlayerInfo[targetid][pAccount];
pawn Код:
format(string, sizeof(string), "Details: "COL_WHITE"Money:[$%d] Bank:[$%d] Total wealth:[$%d] Job:[%s]",Comma(PlayerInfo[targetid][pCash]),Comma(PlayerInfo[targetid][pAccount]),Comma(totalwealth),jtext);
        SendClientMessage(playerid, COLOR_SZR,string);
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;
}
Reply
#2

Change the %d to %s

The Comma function returns a string so if you use an integer specifier, it will give weird kind of looking texts.
Reply
#3

weird, but thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)