Wenn man aus dem Auto aussteigt ist der geschwindigkeit Textdraw immer noch da ... aber der soll weg sein wenn man aussteigt kann das jemand mal überprüfen ?
ZitatAlles anzeigen
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == PLAYER_STATE_ONFOOT)
{
TextDrawHideForPlayer(playerid, Speedo[playerid]);
}
return 1;
}
public UpdateSpeed()
{
new Float:x,Float:y,Float:z;
new Float:distance,value,string[256];
new Float:health;
for(new i=0; i {
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
TextDrawDestroy(Speedo[i]);
}
}
for(new i=0; i {
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
GetPlayerPos(i, x, y, z);
GetVehicleHealth(GetPlayerVehicleID(i), health);
distance = floatsqroot(floatpower(floatabs(floatsub(x,SavePlayerPos[i][LastX])),2)+floatpower(floatabs(floatsub(y,SavePlayerPos[i][LastY])),2)+floatpower(floatabs(floatsub(z,SavePlayerPos[i][LastZ])),2));
value = floatround(distance * 5000);
if(UpdateSeconds > 1)
{
value = floatround(value / UpdateSeconds);
}
format(string,sizeof(string),"~n~~b~KMH : ~w~%d",floatround(value/1600),floatround(value/1000));
Speedo[i] = TextDrawCreate(320.00, 380.00, string);
TextDrawSetOutline(Speedo[i], 0);
TextDrawFont(Speedo[i], 2);
TextDrawSetProportional(Speedo[i], 2);
TextDrawAlignment(Speedo[i], 2);
TextDrawShowForPlayer(i, Speedo[i]);
}
SavePlayerPos[i][LastX] = x;
SavePlayerPos[i][LastY] = y;
SavePlayerPos[i][LastZ] = z;
}
}