%.1f of inputted value - 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)
+--- Thread: %.1f of inputted value (
/showthread.php?tid=425355)
%.1f of inputted value -
EV007 - 25.03.2013
hey, how could I get only the %.1f of inputted float value? I want to store the value into a file but with %.1f type, because the value can be set by admin up to more numbers after the point.
Re: %.1f of inputted value -
EV007 - 25.03.2013
pawn Код:
new Float:limit;
if(sscanf(inputtext, "f",limit))
{
return ShowPlayerDialog(playerid,DIALOG_VDISTANCE,DIALOG_STYLE_INPUT,"Distance settings","Establish vehicle spawn distance limit {FF0000}ERROR","OK","Back");
}
INI_Open("Settings.ini");
INI_WriteFloat("SpawnDistanceLimit",limit);
INI_Save();
INI_Close();
ServerI[SpawnDistanceLimit]=limit;
The value can be i.e 10.45434259 , but I only want to store 10.4 into the file and the variable, I've done this before but I cant remember how..
Re: %.1f of inputted value -
EV007 - 25.03.2013
I'm using SII, it doesn't have that.
Re: %.1f of inputted value -
Scenario - 25.03.2013
... and then you can use
floatstr to transform the string back into a float value when you load it!