How to get vehicle speed in this format KMph or Mph ???
#2

try this i dont know if works...

pawn Код:
stock GetSpeedKM(playerid)
{
    new Float:PosX;
    new Float:PosY;
    new Float:PosZ;
    GetPlayerPos(playerid, PosX, PosY, PosZ);
    new value;
    new Float:PlayerSpeedDistance;
    PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(PosX,ReadPlayerPosition[playerid][ReadX])),2)+floatpower(floatabs(floatsub(PosY,ReadPlayerPosition[playerid][ReadY])),2)+floatpower(floatabs(floatsub(PosZ,ReadPlayerPosition[playerid][ReadZ])),2));
    value = floatround(PlayerSpeedDistance * 5000);
    new KPH = floatround(value/800);
    return KPH;
}
//==============================================================================
stock GetSpeedMP(playerid)
{
    new Float:PosX;
    new Float:PosY;
    new Float:PosZ;
    GetPlayerPos(playerid, PosX, PosY, PosZ);
    new value;
    new Float:PlayerSpeedDistance;
    PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(PosX,ReadPlayerPosition[playerid][ReadX])),2)+floatpower(floatabs(floatsub(PosY,ReadPlayerPosition[playerid][ReadY])),2)+floatpower(floatabs(floatsub(PosZ,ReadPlayerPosition[playerid][ReadZ])),2));
    value = floatround(PlayerSpeedDistance * 5000);
    new MPH = floatround(value/1400);
    return MPH;
}
Reply


Messages In This Thread
How to get vehicle speed in this format KMph or Mph ??? - by mysql - 06.03.2010, 08:46
Re: How to get vehicle speed in this format KMph or Mph ??? - by SlashPT - 06.03.2010, 08:52
Re: How to get vehicle speed in this format KMph or Mph ??? - by mysql - 06.03.2010, 08:54

Forum Jump:


Users browsing this thread: 1 Guest(s)