Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum c { Text3D:Texto, Timer };
- new Veiculo[MAX_VEHICLES][c];
- public OnFilterScriptInit()
- {
- for(new i = 1; i < MAX_VEHICLES; i ++)
- {
- new Float:health, str[50], cor;
- GetVehicleHealth(i, health);
- format(str, sizeof str, "Vida do veiculo: %.1f", health);
- if(1000 >= health > 2000/3) { cor = 0x04D608FF; }
- else if(2000/3 >= health >= 1000/3) { cor = 0xF09F0AFF; }
- else { cor = 0xFF0000FF; }
- Veiculo[i][Texto] = Create3DTextLabel(str, cor, 0.0, 0.0, 0.0, 30.0, 0, 0 );
- Attach3DTextLabelToVehicle( Veiculo[i][Texto], i, 0.0, 0.0, 2.2);
- Veiculo[i][Timer] = SetTimerEx("Atualizar", 500, true, "i", i);
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i = 0; i < MAX_VEHICLES; i ++) { Delete3DTextLabel(Veiculo[i][Texto]); }
- return 1;
- }
- forward Atualizar(vehicleid);
- public Atualizar(vehicleid)
- {
- if(!GetVehicleModel(vehicleid)) return KillTimer(Veiculo[vehicleid][Timer]);
- new Float:health, str[50], cor;
- GetVehicleHealth(vehicleid, health);
- format(str, sizeof str, "Vida do veiculo: %.1f", health);
- if(1000 >= health > 2000/3) { cor = 0x04D608FF; }
- else if(2000/3 >= health >= 1000/3) { cor = 0xF09F0AFF; }
- else { cor = 0xFF0000FF; }
- Update3DTextLabelText(Veiculo[vehicleid][Texto], cor, str);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment