#include <a_samp>
new Text:seb = TextDrawCreate(200,200,\"sebesseg\");
new timer[MAX_PLAYERS];
public OnPlayerEnterVehicle(playerid,vehicleid)
{
new str[128];
format(str,128,\"%d\",GetPlayerSpeed(playerid));
TextDrawSetString(seb,str);
TextDrawShowForPlayer(playerid,seb);
timer[playerid] = SetTimerEx(\"timercar\",500,true,\"d\",playerid);
return 1;
}
public OnPlayerExitVehicle(playerid,vehicleid)
{
KillTimer(timer[playerid]);
TextDrawHideForPlayer(playerid);
return 1;
}
public timercar(playerid);
public timercar(playerid)
{
new str[128];
format(str,128,\"%d\",GetPlayerSpeed(playerid));
TextDrawSetString(seb,str);
}
stock GetPlayerSpeed(playerid)
{
new speed;
if(!IsPlayerInAnyVehicle(playerid)) return -1;
new Float:VelocityX;
new Float:VelocityY;
new Float:VelocityZ;
GetVehicleVelocity(GetPlayerVehicleID(playerid),VelocityX,VelocityY,VelocityZ);
speed = floatround(floatpower((VelocityX*VelocityX)+(VelocityY*VelocityY)+(VelocityZ*VelocityZ),0.5)*217.5);
return speed;
}