[Ajuda] Representar FLOAT em |
#1

Como eu faзo pra criar um loop que pra cada 5.0 de getplayerhealth coloca-se 1 | nesse meu cod
pawn Код:
format(cabecastring, sizeof(cabecastring), "HP: %.1f", health );
        new Text3D:hpcabeca = Create3DTextLabel(cabecastring, COLOR_RED, 0.0, 0.0, 0.0, 25.0, 0);
        Attach3DTextLabelToPlayer(hpcabeca, i, 0.0, 0.0, 0.1);
Pra tipo se tive-se 100.0 de life a barra fica-se assim
pawn Код:
format(cabecastring, sizeof(cabecastring), "HP: ||||||||||||||||||||");
        new Text3D:hpcabeca = Create3DTextLabel(cabecastring, COLOR_RED, 0.0, 0.0, 0.0, 25.0, 0);
        Attach3DTextLabelToPlayer(hpcabeca, i, 0.0, 0.0, 0.3);
Reply
#2

Usa o mйtodo do castiel.
Reply
#3

pawn Код:
new Float:health, Float:i = 0.0, lifeBar[35] = "HP: ";
GetPlayerHealth(playerid,health);

if ( health > 100.0 )
    health = 100.0;

while ( i < health ) {

    strcat(lifeBar, "|", 35);
    i += 5.0;
}

new Text3D:hpcabeca = Create3DTextLabel(lifeBar, COLOR_RED, 0.0, 0.0, 0.0, 25.0, 0);
Attach3DTextLabelToPlayer(hpcabeca, playerid, 0.0, 0.0, 0.3);
Detalhe: Nгo testei, mas creio que seja funcional!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)