format(string,sizeof(string),"your money %s",FormatNumber(PlayerInfo[playerid][pMoney])); SendClientMessage(playerid,-1,string);
stock FormatNumber(number) { new Str[15]; format(Str, 15, "%d", number); if (strlen(Str) < sizeof(Str)) { if (number >= 1000 && number < 10000) strins( Str, ",", 1, sizeof(Str)); else if (number >= 10000 && number < 100000) strins(Str, ",", 2, sizeof(Str)); else if (number >= 100000 && number < 1000000) strins(Str, ",", 3, sizeof(Str)); else if (number >= 1000000 && number < 10000000) strins(Str, ",", 1, sizeof(Str)),strins(Str, ",", 5, sizeof(Str)); else if (number >= 10000000 && number < 100000000) strins(Str, ",", 2, sizeof(Str)),strins(Str, ",", 6, sizeof(Str)); else if (number >= 100000000 && number < 1000000000) strins(Str, ",", 3, sizeof(Str)),strins(Str, ",", 7, sizeof(Str)); else if (number >= 1000000000 && number < 10000000000) strins(Str, ",", 1, sizeof(Str)), strins(Str, ",", 5, sizeof(Str)), strins(Str, ",", 9, sizeof(Str)); else format(Str, 10, "%d", number); } else format( Str, 15, "<NUMBER ERROR>" ); return Str; }
try this
Код:
format(string,sizeof(string),"your money %s",FormatNumber(PlayerInfo[playerid][pMoney])); SendClientMessage(playerid,-1,string); Код:
stock FormatNumber(number) { new Str[15]; format(Str, 15, "%d", number); if (strlen(Str) < sizeof(Str)) { if (number >= 1000 && number < 10000) strins( Str, ",", 1, sizeof(Str)); else if (number >= 10000 && number < 100000) strins(Str, ",", 2, sizeof(Str)); else if (number >= 100000 && number < 1000000) strins(Str, ",", 3, sizeof(Str)); else if (number >= 1000000 && number < 10000000) strins(Str, ",", 1, sizeof(Str)),strins(Str, ",", 5, sizeof(Str)); else if (number >= 10000000 && number < 100000000) strins(Str, ",", 2, sizeof(Str)),strins(Str, ",", 6, sizeof(Str)); else if (number >= 100000000 && number < 1000000000) strins(Str, ",", 3, sizeof(Str)),strins(Str, ",", 7, sizeof(Str)); else if (number >= 1000000000 && number < 10000000000) strins(Str, ",", 1, sizeof(Str)), strins(Str, ",", 5, sizeof(Str)), strins(Str, ",", 9, sizeof(Str)); else format(Str, 10, "%d", number); } else format( Str, 15, "<NUMBER ERROR>" ); return Str; } |
CMD:mymoney(playerid,params[]) { new string23[70]; format(string23,sizeof(string23),"your money %s ",FormatNumber(GetPlayerMoney(playerid))); SendClientMessage(playerid,-1,string); return 1; }
Use %s instead of %d, FormatNumber returns a string not an integer
|