Commas not working - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Commas not working (
/showthread.php?tid=637136)
Commas not working -
aoky - 09.07.2017
PHP код:
stock Comma(numbers)
{
new temp[24],counter = -1;
valstr(temp,numbers);
for(new i = strlen(temp);i > 0; i--)
{
counter++;
if(counter == 3)
{
strins(temp,",",i);
counter = 0;
}
}
return temp;
}
PHP код:
format(str, sizeof(str), "{007200}»{FFFFFF} Money:[$%d] | Bank:[$%d] | Paycheck:[$%d] | Savings:[$%d]",Comma(Character[playerid][Cash]), Comma(Character[playerid][Bank]), Comma(Character[playerid][Payday]), Comma(Character[playerid][Savings]));
Results in:
PHP код:
Money:[$49] | Bank:[$49] | Paycheck:[$50] | Savings:[$49]
Re: Commas not working -
Toroi - 09.07.2017
use
%s when formatting as what that function returns is a string.