06.03.2010, 08:52
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;
}