SA-MP Forums Archive
Convert MPH to KM/H - 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: Convert MPH to KM/H (/showthread.php?tid=610987)



Convert MPH to KM/H - iWindows - 01.07.2016

i would like to know how to convert that system to KM/H

Код:
stock Float:GetPlayerSpeed(playerid)
{
	static Float:velocity[3];

	if (IsPlayerInAnyVehicle(playerid))
	    GetVehicleVelocity(GetPlayerVehicleID(playerid), velocity[0], velocity[1], velocity[2]);
	else
	    GetPlayerVelocity(GetPlayerVehicleID(playerid), velocity[0], velocity[1], velocity[2]);

	return floatsqroot((velocity[0] * velocity[0]) + (velocity[1] * velocity[1]) + (velocity[2] * velocity[2])) * 100.0;
}



Re: Convert MPH to KM/H - Dayrion - 01.07.2016

1mph= 1.609344kph
It's enough to know how to solve this?


Re: Convert MPH to KM/H - iWindows - 01.07.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
1mph= 1.609344kph
It's enough to know how to solve this?
i'm trying but i don't thing that enough rsrs i'm a begginer


Re: Convert MPH to KM/H - SickAttack - 01.07.2016

You would be able to do this conversion easily, if you went or if you're going to school obviously.

I have 100 apples and I want to convert these apples to bananas, a banana equals to 2 apples. So what do I do?
100 apples x 2 bananas = 200 bananas

I'm pretty sure you could do the conversion of what you want. Good luck!


Re: Convert MPH to KM/H - Trucido - 01.07.2016

Quote:
Originally Posted by iWindows
Посмотреть сообщение
i'm trying but i don't thing that enough rsrs i'm a begginer
divide


Re: Convert MPH to KM/H - itsCody - 01.07.2016

Could use this

PHP код:
GetPlayerSpeed(playeridbool:kmh false)
{
    new 
Float:VxFloat:VyFloat:VzFloat:rtn;
    if(
IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid), VxVyVz); else GetPlayerVelocity(playeridVxVyVz);
    
rtn floatsqroot(floatabs(floatpower(Vx Vy Vz2)));
    return 
kmh floatround(rtn 100 1.61) : floatround(rtn 100);

set it to true to use kph


Re: Convert MPH to KM/H - PrO.GameR - 01.07.2016

How old are you? 7? cuz this is something an 8 y/o would be able to solve. god damn it this new generation can't do a simple multiply by 1.61 and they expect to somehow have their server succeed.
Seriously this was purely a ****** and a multiply away from you, and you decided to make a forum help topic about it, how lazy can you be.

And NO, you are not a beginner or a newbie or w/e, you are a useless guy who wants stuff to be spoon-fed to him, and refuses to search about his problem and try to solve it himself.
If you think I'm being rude or harsh, I don't give a flying duck, change your lifestyle, stop being a couch potato.


Re: Convert MPH to KM/H - hbourne - 09.05.2017

stock Float:GetPlayerSpeed(playerid)
{
static Float:velocity[3];

if (IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid), velocity[0], velocity[1], velocity[2]);
else
GetPlayerVelocity(GetPlayerVehicleID(playerid), velocity[0], velocity[1], velocity[2]);

return floatsqroot((velocity[0] * velocity[0]) + (velocity[1] * velocity[1]) + (velocity[2] * velocity[2])) * 100.0*1.609344;
}