SA-MP Forums Archive
Help with...ehm floatround - 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: Help with...ehm floatround (/showthread.php?tid=167532)



Help with...ehm floatround - Sascha - 12.08.2010

"tag missmatch"

I got:

Код:
new Float:b;
b = m/20;
floatround(b, floatround_floor);
p = (b * 20);
m is defined as player money and the warning is at the p = (b * 20) line


Re: Help with...ehm floatround - JaTochNietDan - 12.08.2010

What variable type is p?

Also the floatround(); function doesn't actually store the final result in the variable, it returns the value instead. So it should be used like so, although I don't understand why you'd convert it to a float, so I recommend doing it like this if there's no other reason..

pawn Код:
new b;
b = m/20;
p = (b * 20);



Re: Help with...ehm floatround - Sascha - 12.08.2010

well the problem is I use it to refuel... 1 gallon = 20$... the m = GetPlayerMoney(playerid);
if he has e.g. 46$ I want the system to find out how many gallons the player can get...so:
new Float: p;
p = m/20; //so Money/price;
but now p is no rounded number... it's 2.4
so I want to round down to 2.0


Re: Help with...ehm floatround - JaTochNietDan - 12.08.2010

Quote:
Originally Posted by Sascha
Посмотреть сообщение
well the problem is I use it to refuel... 1 gallon = 20$... the m = GetPlayerMoney(playerid);
if he has e.g. 46$ I want the system to find out how many gallons the player can get...so:
new Float: p;
p = m/20; //so Money/price;
but now p is no rounded number... it's 2.4
so I want to round down to 2.0
Ok I understand, then you can try this

pawn Код:
new b = floatround(m/20, floatround_floor);
p = (b * 20);