Command doesn't update floats.
#5

Quote:
Originally Posted by Emmet_
View Post
Use floatstr(). It converts a string to a floating point value.

Make sure you wrap it around inputtext, e.g:

pawn Code:
floatstr(inputtext)
For integers, you use "strval":

pawn Code:
strval(inputtext)
Code:

pawn Code:
if(ListItem[playerid] == 2)
{
    format(GlobalQuery, sizeof(GlobalQuery), "UPDATE `factions` SET `IntX` = %.2f WHERE `FacID` = %d", floatstr(inputtext), FID[playerid]);
    mysql_function_query(MySQLConnection, GlobalQuery, true, "Query", "");
    format(GlobalString, sizeof(GlobalString), "Interior X set to %.2f.", floatstr(inputtext));
    SendClientMessage(playerid, COLOR_WHITE, GlobalString);
    FID[playerid] = 0;
    ListItem[playerid] = 0;
}
Thanks it works. But only does 5. For example, 123.456 was entered, it'd be 123.45
Reply


Messages In This Thread
Command doesn't update floats. - by BleverCastard - 21.03.2015, 16:41
Re: Command doesn't update floats. - by Loot - 21.03.2015, 16:46
Re: Command doesn't update floats. - by BleverCastard - 21.03.2015, 16:49
Re: Command doesn't update floats. - by Emmet_ - 21.03.2015, 16:57
Re: Command doesn't update floats. - by BleverCastard - 21.03.2015, 22:54
Re: Command doesn't update floats. - by Konstantinos - 21.03.2015, 22:59
Re: Command doesn't update floats. - by BleverCastard - 22.03.2015, 16:50

Forum Jump:


Users browsing this thread: 2 Guest(s)