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



AddCommas - Lidor124 - 12.02.2014

I have never understand that function and how to use it.. i need to insert it to a format with variable BizInfo[idx][bMoney]
i tried AddCommas(BizInfo[idx][bMoney]);
it returns fake amount of money like 49 instead of 23,456 for example.

format(string, sizeof(string), "You have $%d in your vault.", AddCommas(BizInfo[idx][bMoney]));
PLEASE HELP !


Re: AddCommas - Golimad - 12.02.2014

Normaly, it should be like this, I don't know what's AddCommas in your script, but try to update your format string to this
pawn Код:
format(string, sizeof(string), "You have $%d in your vault.", BizInfo[idx][bMoney]);
Also, be sure that your string can contain many numbers ..
like if your BizMoney = 10000, and your string character is string[1] , all what you will see is You have $1 in your vault;
I mean, your string should be "bigger", take a string of 64; string[64];


Re: AddCommas - Kirollos - 12.02.2014

i suppose you should use %s because AddCommas returns a string?


Re: AddCommas - CoaPsyFactor - 12.02.2014

if it contains commas that means its string not integer, so use %s istead of %d


Re: AddCommas - Golimad - 12.02.2014

He could simply use BizInfo[idx][bMoney] instead of Addcommas ?


Re: AddCommas - Kirollos - 12.02.2014

Quote:
Originally Posted by Golimad
Посмотреть сообщение
He could simply use BizInfo[idx][bMoney] instead of Addcommas ?
he wants to add commas between numbers


Re: AddCommas - Golimad - 12.02.2014

Quote:
Originally Posted by kirollos
Посмотреть сообщение
he wants to add commas between numbers
Ah ! I see now what Commas mean :P ! It should be %s instead of %d then !