16.05.2012, 09:52
Quote:
|
I've never seen this, so pardon me if it's already been posted:
Converting a price number (e.g. "$1000") into a price string (e.g. "$1,000"): How this works: When you format a string or use SendClientMessageEx, you normally use "$%d" for a price. With this stock, you just use "%s" and it will convert it into currency format. Example: pawn Код:
pawn Код:
|
pawn Код:
if(strcmp(tmp,"confirm",true) == 0)
{
new pricestring[32];
new price = PlayerInfo[playerid][hValue]/4;
new j = valstr(pricestring,price);
while(j >= 4) { j -= 3; strins(pricestring,",",j); }
strins(pricestring,"$",0);
GiveMoney(playerid, price);
PlayerPlaySound(playerid, Songs[1][0], 0.0, 0.0, 0.0);
SetTimerEx("StopSongTimer", 5000, false, "i", playerid);
format(string, sizeof(string), "Congratulations, You have sold your property and received 25 percent of the value, %s.", pricestring);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "~w~Congratulations~n~ You have sold your property for ~n~~g~%s", pricestring);
GameTextForPlayer(playerid, string, 10000, 3);
RejectHouse(playerid);
OnPlayerSave(playerid);
}

