fairyoggy Posted July 5, 2019 Share Posted July 5, 2019 --server function playerDamage_text ( attacker, weapon, bodypart, loss, dmg ) --when a player is damaged if bodypart then local message message = ("- "..loss.." hp") outputChatBox(message, root) end end addEventHandler ( "onPlayerDamage", getRootElement (), playerDamage_text ) --client local dmg = dxDrawText("- "..hp.." hp", x + 10 - w / 4, y - 15 - h - 12, w, h, tocolor(255, 0, 0), 1, "default-bold","left","top",false,false,false,true) chat writes damage. How to make the damage written in dxDrawText ? Link to comment
Dimos7 Posted July 5, 2019 Share Posted July 5, 2019 (edited) function playerDamage(attacker, bodypart, loss) if bodypart then hp = loss addEventHandler("onClientRender", root, function() local dmg = dxDrawText("- "..hp.." hp", x + 10 - w / 4, y - 15 - h - 12, w, h, tocolor(255, 0, 0), 1, "default-bold","left","top",false,false,false,true) end) end end addEventHandler("onClientPlayerDamage", root, playerDamage) try this Edited July 5, 2019 by Dimos7 Link to comment
fairyoggy Posted July 5, 2019 Author Share Posted July 5, 2019 how to make setVisible(false) for dxDrawText ? Link to comment
HassoN Posted July 5, 2019 Share Posted July 5, 2019 (edited) 1 hour ago, slapz0r said: how to make setVisible(false) for dxDrawText ? Use a variable. For example: local visible = true if visible then dxDrawText(...) end so you may set "visible" to true or false whenever you want to show/hide the text. Edited July 5, 2019 by Has[S]oN 1 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