Jump to content

damage


Recommended Posts

--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
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 by Dimos7
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...