SA-MP Forums Archive
money with "." - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: money with "." (/showthread.php?tid=623619)



money with "." - GabiXx - 02.12.2016

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$ ?


Re: money with "." - oMa37 - 02.12.2016

NumberWithSign(value);

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


Re: money with "." - GabiXx - 02.12.2016

NumberWithSign(value) change in stock? or string?


Re: money with "." - Dayrion - 02.12.2016

Check your PM ..


Re: money with "." - SickAttack - 02.12.2016

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;
}



Re: money with "." - GabiXx - 02.12.2016

It's done. Thank Dayrion.


Re: money with "." - SickAttack - 02.12.2016

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