The online racing simulator
How to Round Distances?
Hello. I am using version 7.0.9.0 lapper. I record the total distance of a person during the time they connect to the server, but I see fractional numbers. Is this lapper related? Older version lappers round the number.

".GetPlayerVar( $argv,"TotDistMeter"). "
Sub DistFromUser($userName,$argv)
$total = ToNum( ToNum( GetCurrentPlayerVar( "X" ) - GetPlayerVar( $argv, "X" ) - ToNum( GetCurrentPlayerVar( "Y" ) - GetPlayerVar( $argv, "Y" ) ) ) );

IF ( ToNum($total) < 0 )
THEN
$total = $total * -1;
ENDIF

Return($total);

EndSub

Also, this is how the distance in the police system is calculated. I check but there is no difference. Could it be related to the version change?
Do you need to round the number to the nearest integer, or you just do not want to display any digits after a decimal point, when showing it on screen?

I'm guessing there is a way to cast float into an integer, or to use some stardard string formating procedure to create a substring which has no digits after a decimal point.
I think you should do some research. I've opened a similar topic before
Quote from rane_nbg :Do you need to round the number to the nearest integer, or you just do not want to display any digits after a decimal point, when showing it on screen?

I'm guessing there is a way to cast float into an integer, or to use some stardard string formating procedure to create a substring which has no digits after a decimal point.

Actually, it could be both. As long as I get rid of the numbers after the comma. Big grin
Then I suggest to lookup how to create a substring that removes all characters after decimal point, including the point. I don't know what programing language lapper uses, try to dig that out then google how to do substrings in it.
** Best answer **
Ok I solved my problem. I should share a few things for other users to benefit from.

https://www.lfs.net/forum/thread/104861-Display-vehicle-speed-without-fractions

".Round(GetPlayerVar( $argv,"TotDistMeter"),0). "

Check this forum. Because there is important information. This is the solution. Check and compare with the post at the beginning of the topic, it will be useful to you.

Thank you Arda. It would be better if he posted the forum link next time. Isn't helping or getting help a good thing? Smile
Or yes, dig a little bit more in this forum. It seems we already disscused about this, I forgot already Smile
This thread is closed

FGED GREDG RDFGDR GSFDG