SA-MP Forums Archive
Integer help - 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: Integer help (/showthread.php?tid=505707)



Integer help - Lidor124 - 09.04.2014

Hey, i need to get a float value and change it to integer.
What should i use? strval, strmid etc... https://sampwiki.blast.hk/wiki/Strval

I need to get distance of player from a point and then it divide the distance by 5 and multiplier it by 4.

Float var:
Код:
new Float: vDistance = GetVehicleDistanceFromPoint(vehicleid, HouseInfo[rand][hExteriorX], HouseInfo[rand][hExteriorY], HouseInfo[rand][hExteriorZ]);
I'm getting from this line tag mismatch because it a float and not an integer.
Код:
MoneyDistance[playerid] = ((vDistance/5) * 4);
+REP.


Re: Integer help - Twizted - 09.04.2014

Quote:
Originally Posted by Lidor124
Посмотреть сообщение
Hey, i need to get a float value and change it to integer.
What should i use?
https://sampwiki.blast.hk/wiki/Floats#Float_-.3E_Integer


Re: Integer help - Niko_boy - 09.04.2014

MoneyDistance[playerid] = floatround((vDistance/5.0) * 4.0);
should do it.


Re: Integer help - Lidor124 - 09.04.2014

Thanks both, +REP