a number formatting is possible? -
rollercaster - 24.07.2018
can form a number of 0.00004526 as to BitCoin?
ex: Give +10 BTC Cent = 0.00004536
for a BitCoin system
Re: a number formatting is possible? -
KinderClans - 24.07.2018
pawn Код:
stock FormatNumber(iNum, const szChar[] = ",")
{
new
szStr[16]
;
format(szStr, sizeof(szStr), "%d", iNum);
for(new iLen = strlen(szStr) - 3; iLen > 0; iLen -= 3)
{
strins(szStr, szChar, iLen);
}
return szStr;
}
Re: a number formatting is possible? -
rollercaster - 24.07.2018
that's what I did, but the problem is that I can not set up 0.0000235 ( formatted )
Without formatting 0.0000235
thank you so much for helping.
Re: a number formatting is possible? -
KinderClans - 24.07.2018
pawn Код:
new msg[128];
format(msg, sizeof(msg), "You have %s $ in your bank account.", FormatNumber(Player[playerid][Bank]));
SendClientMessage(playerid, -1, msg);
Re: a number formatting is possible? -
rollercaster - 24.07.2018
Quote:
Originally Posted by KinderClans
pawn Код:
new msg[128]; format(msg, sizeof(msg), "You have %s $ in your bank account.", FormatNumber(Player[playerid][Bank])); SendClientMessage(playerid, -1, msg);
|
that's what I did, but the problem is that I can not set up 0.0000235 ( formatted )
Without formatting 00000235
Re: a number formatting is possible? -
KinderClans - 24.07.2018
What are you trying to do?
Re: a number formatting is possible? -
rollercaster - 24.07.2018
Quote:
Originally Posted by KinderClans
What are you trying to do?
|
make a BitCoin system on the server
example of BTC 0.0000000000 , and receive 24 cents BTC which will be equal to 0.0000000024
but the variable can not put 00000012 ..
- I tried with 2 variables: new a = 2; // 2 BRC, new b = 00000012; cent BRC
format(form, sizeof(form), "%d.%d", a, b);// but the result is 2.12 and I want it to be 2.00000012
Re: a number formatting is possible? -
KinderClans - 24.07.2018
Try with this include:
https://github.com/GRGServer/SAMP/bl...rmatnumber.inc
Re: a number formatting is possible? -
Logic_ - 25.07.2018
Not very sure what you're trying to do, but try this maybe?
Код:
format(str, sizeof str, "%.10f", value);