23.12.2018, 01:46
how to format a number
like this 2000 = 2,000
like this 2000 = 2,000
IntegerWithDelimiter(integer, delimiter[] = ",") {
new string[16];
format(string, sizeof string, "%i", integer);
for (new i = strlen(string) - 3, j = ((integer < 0) ? 1 : 0); i > j; i -= 3) {
strins(string, delimiter, i, sizeof string);
}
return string;
}
format(string, sizeof ( string ), "$ %s", IntegerWithDelimiter (1000000 )) ;
convertNumber(value) { // http://forum.sa-mp.com/showthread.ph...781#post843781 new string[24]; format(string, sizeof(string), "%d", value); for(new i = (strlen(string) - 3); i > (value < 0 ? 1 : 0) ; i -= 3) { strins(string[i], ",", 0); } return string; }