SA-MP Forums Archive
[Ajuda] Representar FLOAT em | - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Representar FLOAT em | (/showthread.php?tid=558449)



Representar FLOAT em | - oliverarrow - 17.01.2015

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);



Re: Representar FLOAT em | - CLANdok - 17.01.2015

Usa o mйtodo do castiel.


Re: Representar FLOAT em | - Gii - 17.01.2015

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!