15.10.2010, 15:34
pawn Код:
public Speedo()
{
new Float:Speedo_HP;
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerInAnyVehicle(i))
{
new vehicle = GetPlayerVehicleID(i);
GetVehicleHealth(vehicle, Speedo_HP);
new Float:X, Float:Y, Float:Z, Float:Sp;
GetVehicleVelocity(vehicle, X, Y, Z);
Sp = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)), floatpower(Z, 2))), 100.0);
Speed[i]=floatround(floatdiv(Sp, 0.75), floatround_floor);
if(SpeedoON[i] == 0)
{
TextDrawShowForPlayer(i, Speedd[i]);
TextDrawShowForPlayer(i, Vehicle[i]);
TextDrawShowForPlayer(i, Health[i]);
SpeedoON[i] = 1;
}
new string[128];
format(string,sizeof(string),"Masina: %s",VehicleNames[GetVehicleModel(vehicle)-400]);
TextDrawSetString(Vehicle[i], string);
format(string,sizeof(string),"Viteza: %dmp/h",Speed[i]);
TextDrawSetString(Speedd[i], string);
format(string,sizeof(string),"Viata: %.2f", Speedo_HP);
TextDrawSetString(Health[i], string);
}
else if(SpeedoON[i] == 1)
{
TextDrawHideForPlayer(i, Speedd[i]);
TextDrawHideForPlayer(i, Vehicle[i]);
TextDrawHideForPlayer(i, Health[i]);
SpeedoON[i] = 0;
}
}
}