02.07.2015, 11:02
PHP код:
public OnGameModeInit()
{
SetTimer("Velocimentro", 300, true);
return 1;
}
forward Velocimetro();
public Velocimetro()
{
new Float: Speedo_HP;
new str1[128], str2[128], str3[128], str4[128];
new GasEtempo[MAX_PLAYERS], ResultOwn[MAX_PLAYERS];
for (new i = 0; i < MaiorID; i++)
{
new vehicle = GetPlayerVehicleID(i);
GetVehicleHealth(vehicle, Speedo_HP);
if (gPlayerLogged[i] == 1 && IsPlayerInAnyVehicle(i))
{
if (TextShow[i] == false)
{
TextDrawShowForPlayer(i, box);
TextDrawShowForPlayer(i, box1);
TextDrawShowForPlayer(i, box2);
TextDrawShowForPlayer(i, box3);
TextDrawShowForPlayer(i, box4);
TextDrawShowForPlayer(i, box5);
TextDrawShowForPlayer(i, VeInfo[i]);
TextDrawShowForPlayer(i, kmhor[i]);
TextDrawShowForPlayer(i, GazoInfo[i]);
TextDrawShowForPlayer(i, LataInfo[i]);
//TextDrawShowForPlayer(i, TempoGasInfo[i]);
TextDrawShowForPlayer(i, LocalInf[i]);
TextDrawShowForPlayer(i, SpedUrl);
TextShow[i] = true;
}
//veiculo
format(str1, sizeof(str1), "~w~Veiculo:~g~~h~~h~ %s", vehName[GetVehicleModel(GetPlayerVehicleID(i)) - 400]);
TextDrawSetString(VeInfo[i], str1);
/*if(GetPlayerSpeed(i, true) >= 150)
{
format(str2,sizeof(str2),"~>~~w~Velocidade: ~r~%d KM/H",GetPlayerSpeed(i, true));
TextDrawSetString(kmhor[i], str2);
} */
//velocidade
if (GetPlayerSpeed(i, true) >= 150)
{
format(str2, sizeof(str2), "~w~Velocidade:~w~ %d ~r~~h~KM/H", GetPlayerSpeed(i, true));
TextDrawSetString(kmhor[i], str2);
}
else
{
format(str2, sizeof(str2), "~w~Velocidade:~w~ %d ~g~~h~~h~KM/H", GetPlayerSpeed(i, true));
TextDrawSetString(kmhor[i], str2);
}
// Start do carro
if (Speedo_HP >= 551)
{
format(str4, sizeof(str4), "~w~Lataria:~w~ %0.0f%%", Speedo_HP / 10);
TextDrawSetString(LataInfo[i], str4);
}
else if (Speedo_HP >= 361)
{
format(str4, sizeof(str4), "~w~Lataria:~w~ %0.0f%%", Speedo_HP / 10);
TextDrawSetString(LataInfo[i], str4);
}
else
{
format(str4, sizeof(str4), "~w~Lataria:~r~~h~ %0.0f%%", Speedo_HP / 10);
TextDrawSetString(LataInfo[i], str4);
}
// inf tempo gas
GasEtempo[i] = Gas[vehicle] * 18;
ResultOwn[i] = GasEtempo[i] / 60;
if (ResultOwn[i] > 5)
{
format(str4, sizeof(str4), "~w~Gas Tempo:~w~ %d ~g~~h~~h~Min", ResultOwn[i]);
TextDrawSetString(TempoGasInfo[i], str4);
}
else
{
format(str4, sizeof(str4), "~w~Gas Tempo:~w~ %d ~g~~h~~h~Min", ResultOwn[i]);
TextDrawSetString(TempoGasInfo[i], str4);
}
// combustivel
if (Gas[vehicle] >= 20)
{
format(str3, sizeof(str3), "~w~Combustivel:~w~ %d", Gas[vehicle]);
TextDrawSetString(GazoInfo[i], str3);
}
else if (Gas[vehicle] < 20)
{
format(str3, sizeof(str3), "~w~Combustivel:~w~ %d", Gas[vehicle]);
TextDrawSetString(GazoInfo[i], str3);
}
else
{
format(str3, sizeof(str3), "~b~~h~~h~~h~Combustivel:~r~~h~ %d", Gas[vehicle]);
TextDrawSetString(GazoInfo[i], str3);
}
format(str4, sizeof(str4), "~b~~h~~h~~h~Local: ~w~%s", ReturnPlayerZone(i));
TextDrawSetString(LocalInf[i], str4);
}
else
{
if (TextShow[i] == true)
{
TextDrawHideForPlayer(i, box);
TextDrawHideForPlayer(i, box1);
TextDrawHideForPlayer(i, box2);
TextDrawHideForPlayer(i, box3);
TextDrawHideForPlayer(i, box4);
TextDrawHideForPlayer(i, box5);
TextDrawHideForPlayer(i, tacho[i]);
TextDrawHideForPlayer(i, VeInfo[i]);
TextDrawHideForPlayer(i, kmhor[i]);
TextDrawHideForPlayer(i, GazoInfo[i]);
TextDrawHideForPlayer(i, LataInfo[i]);
TextDrawHideForPlayer(i, TempoGasInfo[i]);
TextDrawHideForPlayer(i, LocalInf[i]);
TextDrawHideForPlayer(i, SpedUrl);
TextShow[i] = false;
}
}
}
}