Vehicle velocity problem
#1

I really don't know how velocity works but I use this on my server to get the speed and players complained that the speedo is showing too much, example when Landstalker goes reverse the speed increase up to 55 very fast.

If you drive a glendale straight you reach 160 and on some roads 200.
Sultan goes 200+, those are the vehicles I tested.

Код:
public Speedometer(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
		new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[16],final_speed_int;
		vehicleid = GetPlayerVehicleID(i);
		//new Float:vehicle_health,final_vehicle_health,health_string[256];
		if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
		{
			GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
			final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*250.666667; // 250.666667 = kmph  // 199,4166672= mph
			final_speed_int = floatround(final_speed,floatround_round);
			format(speed_string,256,"%i",final_speed_int);
			TextDrawSetString(speedo0[i], speed_string);
			
		}
	}
    return 1;
}
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=364124
Reply
#3

It's not as simple as it sounds. I use the number in this post.

You can read more about it in the whole thread.
Reply
#4

I did work on a speedometer two years ago where I faced such a problem. I wasn't satisfied with the value I used globally so I managed it to work well by using separate multiplier values according to the maximum speed of the vehicle. I was planning on increasing the vehicle speed limit, so to get things working well on my speedometer, I had to use separate multipliers.
Reply
#5

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
It's not as simple as it sounds. I use the number in this post.

You can read more about it in the whole thread.
Should I put 181.5 instead of 250.66667?
Reply
#6

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
Should I put 181.5 instead of 250.66667?
Obviously.
Reply
#7

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
Obviously.
Thanks, rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)