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(strsizeof(str), "%i"number);
    for(new 
strlen(str)-30-= 3)
    {
        
strins(strsignj);
    }
    return 
str;
}
CMD:setmoney(playeridparams[])
{
    new 
pIDvalue;
    if(
PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, -1"{FF0000}EROARE: {FFFFFF}Nu ai acces la aceasta comanda.");
    else if(
sscanf(params"ui"pIDvalue)) return SendClientMessage(playeridCOLOR_GOLD"Foloseste: /setmoney [id] [suma]");
    else if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_TOM"Jucatorul nu este conectat.");
    else
    {
        new 
string[100], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(pIDtargetsizeof(target));
        
format(stringsizeof(string), "I-ai setat lui "COL_YELLOW"%s "COL_GY"suma de "COL_GREEN"%i$."target,value);
        
SendClientMessage(playeridCOLOR_GYELLOWstring);
        
format(stringsizeof(string), "Ai primit suma de "COL_GREEN"%i$ "COL_GY"de la "COL_YELLOW"%s."valuepName);
        
SendClientMessage(pIDCOLOR_GYELLOWstring);
        
PlayerInfo[pID][pCash] = value;
        
SetPlayerMoney(pIDPlayerInfo[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'.