forward Speedo(playerid);
public Speedo(playerid) {
new vehicleid,
Float:speed_x,
Float:speed_y,
Float:speed_z,
Float:final_speed,
speed_string[256],
final_speed_int;
foreach(Player, i)
{
vehicleid = GetPlayerVehicleID(i);
if(vehicleid != 0) {
GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*125;
final_speed_int = floatround(final_speed,floatround_round);
format(speed_string,256,"Speed: %i Km/H",final_speed_int);
PlayerTextDrawSetString(i,Speedoo[i], speed_string);
PlayerTextDrawShow(playerid, Speedoo [ playerid ] );
PlayerTextDrawShow(playerid, carhealth [ playerid ] );
PlayerTextDrawShow(playerid, dashboard [ playerid ] );
} else {
PlayerTextDrawSetString(i,Speedoo[i], "Speed: 0 Km/H ");
PlayerTextDrawSetString(i,carhealth[i], "Health: 1000");
PlayerTextDrawHide(playerid,Speedoo[playerid]);
PlayerTextDrawHide(playerid, carhealth [playerid] );
PlayerTextDrawHide(playerid, dashboard [ playerid ] );
}
}
return 1;
}
So why are sending the playerid when you are checking all players anyway? Replace playerid with i and don't send it as its not need.
|