I'm looking for an example to basically give the players a message if they were hit by whatever damage. so if hit by bullet, wolf etc. I want it to show they have been hit and to popup a message. I've seen the
OnEntityTakeDamage but not completely sure.
Lua on take damage?
Discussion in 'Rust Development' started by JohnRU, Sep 5, 2015.
-
Wulf Community Admin
Take a look at plugins like Death Notes, the syntax isn't that different.
-
Death Notes uses OnEntityDeath not OnEntityTakeDamage
-
Wulf Community Admin
Oh well, the below may help instead.
Take it as an example, it's just a portion from one of mine locally.Code:function PLUGIN:OnEntityTakeDamage(player, hitinfo) if player:GetComponent("BasePlayer") then if not hitinfo.damageTypes:find("DamageTypeList") or hitinfo.damageTypes:Total() <= 0 then return end local damageType = hitinfo.damageTypes:GetMajorityDamageType() if damageType:find("Fall") then -
forgot 2 "end"s
-
Wulf Community Admin
No, I left them off as I only copied the portion at the start.
That's why I said to take it as an example, don't expect it to work without finishing it off. -
should add some .... to it then
