AddCommas issue.
#1

pawn Код:
stock AddCommas(number)
{
    new
        tStr[13]; // Up to 9,999,999,999,999

    format(tStr,sizeof(tStr),"%d",number);

    if(strlen(tStr) < 4)
    return tStr;

    new
        //rNumber = floatround((number+(number/3)),floatround_floor),
        iPos = strlen(tStr),
        iCount = 1;

    while(iPos > 0)
    {
    if(iCount == 4)
    {
        iCount = 0;
        strins(tStr,",",iPos,1);
            iPos ++;
        }

        iCount ++;
        iPos --;
    }
    return tStr;
}
I use this, which is found at :
https://sampwiki.blast.hk/wiki/AddCommas

But for some reason this function doesn't work, it makes everything '49' strangely.
I'm using it here.

pawn Код:
format(string, sizeof(string), "Welcome to San Fierro Roleplay, %s Level: %d | Money: $%d | Admin Level: %d | Donator Level %d |", GetNameEx(playerid), PlayerLevel[playerid],AddCommas(PlayerMoney[playerid]), AdminLevel[playerid], Donator[playerid]);
EDIT: I REALISE IT'S A STRING. IGNORE.
Reply
#2

Quote:

it makes everything '49' strangely

Elaborate please.
Reply
#3

@Aerotactics: He already solved it. (Read the last line...)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)