float retuns nothing...
#1

i made a topic about this before thinking i knew the solution which i didnt but i need your help fixing the real problem

pawn Код:
new Float:Money2 = 12.34,
                      Doll = floatround(Money, floatround_floor),
                      Cent = floatround(floatfract(Money2)*100));

    //Remove Once Finished.
    new TestString[150];
    format(TestString, sizeof(TestString), "Starter: %f Doll: %i Cent: %i", Doll, Cent);
well the whole string returns nothing...

Quote:

Starter: 0.00000 Doll: 84 Cent:

now the money2 is set to 12.34 as a debug which returns the same empty space yet should be the 34

another problem is that the float gets erased to 0.000000 when i use it once and i need to use it twice which is what the money variable was created for suggested by a friend

can anyone help?
Reply
#2

Take a quick look at the format line.
pawn Код:
"Starter: %f Doll: %i Cent: %i"
You're noting that there should be three values in the format but you only have 2 there, Doll and Cent.

Try
pawn Код:
format(TestString, sizeof(TestString), "Starter: %f Doll: %i Cent: %i", Money2, Doll, Cent);
Reply
#3

I think I answered to this, some hours ago and thats what I said about number of variables and specifiers.

EDIT: why did you create 2 threads? https://sampforum.blast.hk/showthread.php?tid=437191
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)