SA-MP Forums Archive
Script Help - 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: Script Help (/showthread.php?tid=487525)



Script Help - TunisianoGamer - 13.01.2014

Hello I am looking for a method to transfer a number from this Form : 10520950 To this one 10,520,950

any one can help ? Thanks


Re: Script Help - Konstantinos - 13.01.2014

https://sampwiki.blast.hk/wiki/AddCommas


Re: Script Help - TunisianoGamer - 13.01.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Thanks a lot


Re: Script Help - TunisianoGamer - 13.01.2014

CMD:mymoney(playerid, params[])
{
new string[120];
new account = PlayerInfo[playerid][pAccount];
format(string, sizeof(string),"your bank account:%d", account );
SendClientMessageEx(playerid, COLOR_GREEN, string);
return 1;

}
//PlayerInfo[playerid][pAccount] is how much palyer own in the bank for exemple let's say 8000000 i wanna see it in this format 8,000,000
// I have posted the stock AddCommas(number) but i don't know how to use it ,can anyone please try to make that on the cmd_mymoney ?



Thanks


Re: Script Help - IstuntmanI - 13.01.2014

Just use %s and AddCommas with the number parameter:
pawn Код:
CMD:mymoney(playerid, params[])
{
    new string[120];
    format(string, sizeof(string),"your bank account:%s", AddCommas( PlayerInfo[playerid][pAccount] ) );
    SendClientMessageEx(playerid, COLOR_GREEN, string);
    return 1;
}