How to separate numbers with a comma?
#1

Hello guys I need help on how to separate numbers with 1 comma example on this command I want to add commas
Код:
CMD:charity(playerid, params[]) {
	new
		string[128],
		moneys;

	if(isnull(params))
		return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /charity [amount]");

	moneys = strval(params);

	if(moneys < 0)
		return SendClientMessage(playerid, COLOR_GRAD1, "That's not enough!");

	if(GetPlayerCash(playerid) < moneys)
		return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much money.");

	GivePlayerCash(playerid, -moneys);

	format(string, sizeof(string), "%s, thank you for your donation of $%d.",GetPlayerNameEx(playerid), moneys);
	PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
	SendClientMessage(playerid, COLOR_YELLOW, string);

	if(moneys < 50000)

	if(GetPlayerCash(playerid) < moneys)
		return SendClientMessage(playerid, COLOR_GRAD1, "You don't have that much money.");

	GivePlayerCash(playerid, -moneys);
	format(string, sizeof(string), "CHARITY: %s has donated $%d to the San Andreas Charity ((/charity)).",GetPlayerNameEx(playerid), moneys);
	PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
	SendClientMessageToAll(COLOR_DBLUE, string);
	return 1;
}
it's set that if price is higher then 50000 it should send message to all that "ID has donated 50,000 to charity" but I want to make it shows "ID has donated $50,000 to charity"
Reply
#2

showthread.php?t=184328

Wasn't so hard, was it?
Reply
#3

Quote:
Originally Posted by sammp
Посмотреть сообщение
showthread.php?t=184328

Wasn't so hard, was it?
I tried it before but it didn't work I also tried AddThousandSeparators here https://sampwiki.blast.hk/wiki/AddCommas
but it says that ''warning 204: symbol is assigned a value that is never used: "AddThousandSeparators"
Reply
#4

It mean you never used the function in your script, that's all.. uh.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)