Lalalu Posted July 22, 2017 Share Posted July 22, 2017 Buenas, hago este post con el siguiente motivo: He estado creando un hud con unos cuántos tutoriales que he visto, me gusta el resultado pero tengo un pequeño problema...la parte donde aparece el nombre, ok, los nombres salen normales todo bien, el problema es cuando se usan códigos de colores sale por ejemplo #ff00ffpepapig, en vez de el nombre con dicho color pepapig, espero sus respuestas, esto es lo que usé: local name = getPlayerName ( localPlayer ) dxDrawText(""..name, screenW * 0.8508, screenH * 0.0801, screenW * 0.9258, screenH * 0.0947, tocolor(255, 255, 255), 1, "default", "left", "top", false, false, true) Link to comment
Rose Posted July 22, 2017 Share Posted July 22, 2017 El décimo cuarto argumento de dxDrawText es para habilitar el uso de color codes, solo ponlo como true. bool dxDrawText ( string text, float left, float top [, float right=left, float bottom=top, int color=white, float scale=1, mixed font="default", string alignX="left", string alignY="top", bool clip=false, bool wordBreak=false, bool postGUI=false, bool colorCoded=false, bool subPixelPositioning=false, float fRotation=0, float fRotationCenterX=0, float fRotationCenterY=0 ] ) Link to comment
aka Blue Posted July 22, 2017 Share Posted July 22, 2017 Esto debe funcionar dxDrawText(""..name, screenW * 0.8508, screenH * 0.0801, screenW * 0.9258, screenH * 0.0947, tocolor(255, 255, 255), 1, "default", "left", "top", false, false, true, true) Link to comment
Lalalu Posted July 22, 2017 Author Share Posted July 22, 2017 (edited) @aka Blue @Rose Gracias a ambos, para no abrir otro post, tengo otra duda, como podría hacer que se muestre un texto con el procentaje de vida que tiene el jugador? que función debería usar? ejemplo algo como 500/1000 (health 500, max health 1000), a según investigué debo usar algo llamado math.ceil pero no entiendo como usarlo, me podrían explicar ? Edited July 22, 2017 by Lalalu Link to comment
Enargy, Posted July 22, 2017 Share Posted July 22, 2017 math.floor(getElementHealth(localPlayer)) Link to comment
Lalalu Posted July 22, 2017 Author Share Posted July 22, 2017 (edited) @Enargy, me podrías dar un ejemplo? ó explicarme como podría aplicarla al texto? Edited July 22, 2017 by Lalalu Link to comment
Enargy, Posted July 22, 2017 Share Posted July 22, 2017 30 minutes ago, Lalalu said: @Enargy, me podrías dar un ejemplo? ó explicarme como podría aplicarla a un texto? local health = tostring(math.floor(getElementHealth(localPlayer))).."&" dxDrawText(health, ...) Link to comment
Lalalu Posted July 22, 2017 Author Share Posted July 22, 2017 @Enargy, Gracias, creo que ya funciona, otra pregunta, como podría hacer para que no salgan números decímales? osea cuando le baja vida al personaje sale 99.4484854854, y así sucesivamente con todas las cantidades, las únicas sin decímales son el 0 y el 100, como podría hacer para eliminar esos decímales? y que solo baje tipo 99, 97, 96, 95 y así sucesivamente, o es así por defecto y no puede modificarse? Link to comment
Lalalu Posted July 22, 2017 Author Share Posted July 22, 2017 Creo que ya lo logré, gracias a todos Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now