Shadoww5

Vida do veiculo acima dele - Shadoww5

Jul 16th, 2011
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. enum c { Text3D:Texto, Timer };
  2. new Veiculo[MAX_VEHICLES][c];
  3.  
  4. public OnFilterScriptInit()
  5. {
  6.     for(new i = 1; i < MAX_VEHICLES; i ++)
  7.     {
  8.         new Float:health, str[50], cor;
  9.         GetVehicleHealth(i, health);
  10.         format(str, sizeof str, "Vida do veiculo: %.1f", health);
  11.         if(1000 >= health > 2000/3) { cor = 0x04D608FF; }
  12.         else if(2000/3 >= health >= 1000/3) { cor = 0xF09F0AFF; }
  13.         else { cor = 0xFF0000FF; }
  14.         Veiculo[i][Texto] = Create3DTextLabel(str, cor, 0.0, 0.0, 0.0, 30.0, 0, 0 );
  15.         Attach3DTextLabelToVehicle( Veiculo[i][Texto], i, 0.0, 0.0, 2.2);
  16.         Veiculo[i][Timer] = SetTimerEx("Atualizar", 500, true, "i", i);
  17.     }
  18.     return 1;
  19. }
  20.  
  21. public OnFilterScriptExit()
  22. {
  23.     for(new i = 0; i < MAX_VEHICLES; i ++) { Delete3DTextLabel(Veiculo[i][Texto]); }
  24.     return 1;
  25. }
  26.  
  27. forward Atualizar(vehicleid);
  28.  
  29. public Atualizar(vehicleid)
  30. {
  31.     if(!GetVehicleModel(vehicleid)) return KillTimer(Veiculo[vehicleid][Timer]);
  32.     new Float:health, str[50], cor;
  33.     GetVehicleHealth(vehicleid, health);
  34.     format(str, sizeof str, "Vida do veiculo: %.1f", health);
  35.     if(1000 >= health > 2000/3) { cor = 0x04D608FF; }
  36.     else if(2000/3 >= health >= 1000/3) { cor = 0xF09F0AFF; }
  37.     else { cor = 0xFF0000FF; }
  38.     Update3DTextLabelText(Veiculo[vehicleid][Texto], cor, str);
  39.     return 1;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment