anyone know how to make a speedo stable
#1

I AM NOT ASKING HOW TO MAKE A SPEEDO


but yet how to make it accurate. it make it go from 1,2,3,4,5,6,7,8,9,10 etc.. maybe if it skips a few numbers but like really accurate D:
Reply
#2

Код:
GetPlayerSpeed(playerid)
{
	new Float:Vx, Float:Vy, Float:Vz;
	if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), Vx, Vy, Vz);
	else GetPlayerVelocity(playerid, Vx, Vy, Vz);
	return floatround(floatabs((Vx*Vx) + (Vy*Vy) + (Vz*Vz)) * 100);
}

public OnPlayerUpdate(playerid)
{
	if(IsPlayerInAnyVehicle(playerid)) printf("%i", GetPlayerSpeed(playerid));
	return 1;
}
Adjust to a textdraw. However, updating a textdraw ~50 times a second might lag your server.
Reply
#3

example>?
Reply
#4

Updating a speedometer 1000 times a second isn't very smart seeing as the client doesn't update with the server that quickly. If you insist on a fast timer, use OnPlayerUpdate like I posted before.
Reply
#5

[quote

[edit]

example>?
[/quote]
Reply
#6

Quote:
Originally Posted by big comfy couch
Код:
GetPlayerSpeed(playerid)
{
	new Float:Vx, Float:Vy, Float:Vz;
	if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), Vx, Vy, Vz);
	else GetPlayerVelocity(playerid, Vx, Vy, Vz);
	return floatround(floatabs((Vx*Vx) + (Vy*Vy) + (Vz*Vz)) * 100);
}

public OnPlayerUpdate(playerid)
{
	if(IsPlayerInAnyVehicle(playerid)) printf("%i", GetPlayerSpeed(playerid));
	return 1;
}
Adjust to a textdraw. However, updating a textdraw ~50 times a second might lag your server.
22 times a second*, my most accurate test was 2179 times in 100 seconds.
Reply
#7

thx. so i just attach a textdraw to it. e.g showtextdrawforplayer etc etc.. under the onplayerupdate^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)