26.02.2015, 20:32
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;
}
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]);