strval
#1

If I use strval, I only get a value without decimals, but I need a value with 2 decimals behind the comma. How can i make that?
Reply
#2

you would use floatstr instead of strval.

Remember to add the Float tag to the variable you are placing the value in.
Reply
#3

but doesnt floatstr make a float into a string?? and what do you mean by the float tag?
Reply
#4

Quote:
Originally Posted by thuron
but doesnt floatstr make a float into a string?? and what do you mean by the float tag?
No, floatstr turns a string into a float.

And by the Float tag, I mean...

pawn Code:
new Float:var, var2, string[10];
format(string,10,"1.34534");

var = floatstr(string);
var2 = floatstr(string); //var2 did not have the Float tag that tells the compiler that it will contain a floating point number. This is line 5.

/*
compiler output:
C:\blahblahblah(5) : warning 213: tag mismatch
*/
Reply
#5

ok, ill try. thanks
Reply
#6

You could also post this here: http://forum.sa-mp.com/index.php?topic=114667.0
Reply
#7

ah! the high roller has a new post. thats how you get on with more that 3000. could do that too on that way. anyways, i fixed it with the floatstr. thanks kc!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)