strval - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: strval (
/showthread.php?tid=90458)
strval -
thuron - 08.08.2009
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?
Re: strval -
kc - 08.08.2009
you would use floatstr instead of strval.
Remember to add the
Float tag to the variable you are placing the value in.
Re: strval -
thuron - 08.08.2009
but doesnt floatstr make a float into a string?? and what do you mean by the float tag?
Re: strval -
kc - 08.08.2009
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
*/
Re: strval -
thuron - 08.08.2009
ok, ill try. thanks
Re: strval -
MenaceX^ - 08.08.2009
You could also post this here:
http://forum.sa-mp.com/index.php?topic=114667.0
Re: strval -
thuron - 09.08.2009
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!