pawn Код:
stock GetPlayerSpeed(playerid) //MPH
{
new veh = GetClosestVehicle(playerid), pSpeed[MAX_PLAYERS];
if (veh)
{
new Float:x,Float:y,Float:z/*,string[128]*/;
GetVehiclePos(veh,x,y,z);
//IsPlayerAimingAt(veh,x,y,z,25);
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
GetVehicleVelocity(veh, speed_x, speed_y, speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.4166672; // 136.666667 = kmph // 85.4166672= mph
final_speed_int = floatround(final_speed,floatround_round);
/*format(string,sizeof(string),"Speed: %i MPH",final_speed_int,2000);
SendClientMessage(playerid,lightblue,string);*/
pSpeed[playerid] = final_speed+int,2000;
}
return 1;
}
Something like that should work, that is not tested so I am not sure if it will work. Nice work with this.