pawn Код:
for(new i=0; i<GetMaxPlayers(); i++)
{
HUDTexts[i] = TextDrawCreate(HUD_INDEX+5.000000,HUD_INDEX2+90.000000, " "); // escritas
TextDrawAlignment(HUDTexts[i],0);
TextDrawBackgroundColor(HUDTexts[i],0x000000ff);
TextDrawFont(HUDTexts[i],3);
TextDrawLetterSize(HUDTexts[i],0.299999,0.900000);
TextDrawSetProportional(HUDTexts[i],1);
TextDrawSetShadow(HUDTexts[i],1);
TextDrawColor(HUDTexts[i],0xffff00ff);
}
pawn Код:
public CheckGas()
{
new string[128];
string = " ";
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vid = GetPlayerVehicleID(i);
if (GetVehicleModel(GetPlayerVehicleID(i)) != 481 && 510)
{
if(Gas[vid] >= 1)
{
if(Gas[vid] <= 10)
{
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
}
if(gGas[i] == 1)
{
format(string, sizeof(string), "~b~~h~~h~Gasolina: ~w~%d",Gas[vid]);
// GameTextForPlayer(i,string,10000,6);
}
if(Teste[i] == 0 && Velocidade[i] > 10 && GetVehicleModel(vid) != 481 && GetVehicleModel(vid) != 510)
{
tempGas[vid] ++;
if(tempGas[vid] >= 20)
{
tempGas[vid] = 0;
Gas[vid]--;
}
}
}
else
{
if(Teste[i] == 0)
{
NoFuel[i] = 1;
TogglePlayerControllable(i, 0);
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~veiculo sem combustўvel ~n~Use /sair para sair do veўculo",1500,3);
}
}
}
new HGG[265]; new Float:Can;
GetVehicleHealth(GetPlayerVehicleID(i), Can);
GetPlayerPos(i,Xa,Ya,Za);
KMH = floatsqroot(floatpower(floatabs(floatsub(Xa,Xb[i])),2)+floatpower(floatabs(floatsub(Ya,Yb[i])),2)+floatpower(floatabs(floatsub(Za,Zb[i])),2));
KMH *= 7.4;
format(HGG, sizeof(HGG), "~b~~h~~h~Veiculo:~w~ %s ~n~~b~~h~~h~Velocidade: ~w~%0.0f km/h~n~%s~n~~r~~h~Vida: ~w~%.2f", ArIsim[GetVehicleModel(GetPlayerVehicleID(i))-400], KMH,string, Can);
TextDrawSetString(Text:HUDTexts[i], HGG);
if(KMH >= 220)
{
TextDrawTextSize(SpeedBar[i],603.000000,0.000000);
}
else
{
TextDrawTextSize(SpeedBar[i], floatadd(534.0, floatdiv(KMH, 3.900000)),0.000000);
}
TextDrawShowForPlayer(i, SpeedBar[i]);
if(Can < 0)
{
TextDrawTextSize(HealthBar[i],538.000000,0.000000);
}
else if(Can >= 1000)
{
TextDrawTextSize(HealthBar[i],603.000000,0.000000);
}
else
{
TextDrawTextSize(HealthBar[i],floatadd(534.0, floatdiv(Can, 14.6000000)),0.000000);
}
if(SeeHUD[i] == false)
{
SeeHUD[i] = true;
TextDrawShowForPlayer(i, HealthBar[i]);
TextDrawShowForPlayer(i, LowHealthLine);
TextDrawShowForPlayer(i, HUDTexts[i]);
TextDrawShowForPlayer(i, Text:Background);
TextDrawShowForPlayer(i, Text:Topbar);
TextDrawShowForPlayer(i, Text:Leftbar);
TextDrawShowForPlayer(i, Text:Bottombar);
TextDrawShowForPlayer(i, Text:Rightbar);
TextDrawShowForPlayer(i, Text:SpeedBarBackground);
TextDrawShowForPlayer(i, Text:HealthBarBackground);
}
}
else
{
if(SeeHUD[i] == true)
{
SeeHUD[i] = false;
TextDrawHideForPlayer(i, Text:HUDTexts[i]);
TextDrawHideForPlayer(i, Text:SpeedBar[i]);
TextDrawHideForPlayer(i, Text:HealthBar[i]);
TextDrawHideForPlayer(i, Text:Background);
TextDrawHideForPlayer(i, Text:Topbar);
TextDrawHideForPlayer(i, Text:Leftbar);
TextDrawHideForPlayer(i, Text:Bottombar);
TextDrawHideForPlayer(i, Text:Rightbar);
TextDrawHideForPlayer(i, Text:SpeedBarBackground);
TextDrawHideForPlayer(i, Text:HealthBarBackground);
TextDrawHideForPlayer(i, Text:LowHealthLine);
}
}
GetPlayerPos(i,Xb[i],Yb[i],Zb[i]), Xb[i] = Xa; Yb[i] = Ya; Zb[i] = Za;
}
}
return 1;
}