money with "."
#1

I use this:
PHP код:
stock NumberWithSign(const number, const sign[2] = "'")
{
    new 
str[10 + EOS];
    
format(str, sizeof(str), "%i", number);
    for(new 
j = strlen(str)-3; j > 0; j -= 3)
    {
        
strins(str, sign, j);
    }
    return 
str;
}
CMD:setmoney(playerid, params[])
{
    new 
pID, value;
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, -1, "{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    else if(
sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_GOLD, "Foloseste: /setmoney [id] [suma]");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_TOM, "Jucatorul nu este conectat.");
    else
    {
        new 
string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        
GetPlayerName(playerid, pName, sizeof(pName));
        
GetPlayerName(pID, target, sizeof(target));
        
format(string, sizeof(string), "I-ai setat lui "COL_YELLOW"%s "COL_GY"suma de "COL_GREEN"%i$.", target,value);
        
SendClientMessage(playerid, COLOR_GYELLOW, string);
        
format(string, sizeof(string), "Ai primit suma de "COL_GREEN"%i$ "COL_GY"de la "COL_YELLOW"%s.", value, pName);
        
SendClientMessage(pID, COLOR_GYELLOW, string);
        
PlayerInfo[pID][pCash] = value;
        
SetPlayerMoney(pID, PlayerInfo[pID][pCash]);
    }
    return 
1;
} 
What i have to change to money look like 200000$ = 200.000$ ?
Reply
#2

NumberWithSign(value);

And in the format, change %i or %d to %s.
Reply
#3

NumberWithSign(value) change in stock? or string?
Reply
#4

Check your PM ..
Reply
#5

pawn Код:
stock NumberFormat(integer, const separator[] = ",")
{
    new string[16];
    valstr(string, integer);

    if(integer >= 1000)
    {
        for(new i = (strlen(string) - 3); i > 0; i -= 3)
        {
            strins(string, separator, i);
        }
    }
    return string;
}
Reply
#6

It's done. Thank Dayrion.
Reply
#7

Quote:
Originally Posted by GabiXx
Посмотреть сообщение
It's done. Thank Dayrion.
He should be banned for breaking the forum rule 'this is a community'.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)