Commas
#1

Could anyone tell me how to make it so it's $10,000 instead of $10000 or $7,500 instead of $7500? Like I wan't commas put into the numbers.


Код HTML:
  	format(string, sizeof(string), "Money: $%d | Bank: $%d", PlayerInfo[playerid][pMoney], PlayerInfo[playerid][pBank]);
	SendClientMessage(playerid, COLOR_WHITE, string);
Reply
#2

https://sampwiki.blast.hk/wiki/AddCommas
Reply
#3

https://sampwiki.blast.hk/wiki/AddCommas
Edit : someone was faster than me.
Reply
#4

Okay. How would I do that in my situation?

I tried doing this:
Код HTML:
	AddCommas(PlayerInfo[playerid][pMoney]);
But it didn't work.
Reply
#5

How are you using it? Give some more code.
Reply
#6

Quote:
Originally Posted by Dan.
Посмотреть сообщение
How are you using it? Give some more code.
I'm using it in /stats.

Код HTML:
	AddCommas(PlayerInfo[playerid][pMoney]);

  	format(string, sizeof(string), "Money: $%d | Bank: $%d", PlayerInfo[playerid][pMoney], PlayerInfo[playerid][pBank]);
	SendClientMessage(playerid, COLOR_WHITE, string);
Reply
#7

It's not working for you because you are still showing the value of it, you should use it like this:

Код:
format(string, sizeof(string), "Money: $%s | Bank: $%d", AddCommas(PlayerInfo[playerid][pMoney]), PlayerInfo[playerid][pBank]);
	SendClientMessage(playerid, COLOR_WHITE, string);
Reply
#8

Quote:
Originally Posted by Dan.
Посмотреть сообщение
It's not working for you because you are still showing the value of it, you should use it like this:

Код:
format(string, sizeof(string), "Money: $%s | Bank: $%d", AddCommas(PlayerInfo[playerid][pMoney]), PlayerInfo[playerid][pBank]);
	SendClientMessage(playerid, COLOR_WHITE, string);
Okay. Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)