a number formatting is possible?
#1

can form a number of 0.00004526 as to BitCoin?

ex: Give +10 BTC Cent = 0.00004536

for a BitCoin system
Reply
#2

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;
}
Reply
#3

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.
Reply
#4

pawn Код:
new msg[128];
format(msg, sizeof(msg), "You have %s $ in your bank account.", FormatNumber(Player[playerid][Bank]));
SendClientMessage(playerid, -1, msg);
Reply
#5

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
Reply
#6

What are you trying to do?
Reply
#7

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
Reply
#8

Try with this include:

https://github.com/GRGServer/SAMP/bl...rmatnumber.inc
Reply
#9

Not very sure what you're trying to do, but try this maybe?

Код:
format(str, sizeof str, "%.10f", value);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)