Integer help
#1

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.
Reply
#2

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
Reply
#3

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

Thanks both, +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)