[pawn]
stock GetPlayerSpeed(playerid,bool:kmh) // by misco
{
new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}[/pawn]
Használat: (Példa)
[pawn]new string[64];
format(string, 64, \"%d km/h\", GetPlayerSpeed(playerid, true));
TextDrawSetString(textdrawteszt, string);[/pawn]