Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- --Low HP Warning
- AddCSLuaFile()
- util.AddNetworkString("HPLowSound")
- hook.Add("EntityTakeDamage", "CheckPlayerHealth", function(ent, dmginfo)
- if !dmginfo or !IsValid(ent) or !ent:IsPlayer() then return end
- if (ent:Health()-dmginfo:GetDamage()) <= 9 then
- net.Start("HPLowSound")
- net.Send(ent)
- end
- end)
- else
- net.Receive("HPLowSound", function(len)
- if !IsValid(ply) then return end
- timer.Create("HPLowSound_"..ply:EntIndex(), 5, 0, function()
- if !IsValid(ply) or ply:Health() >= 10 then
- timer.Destroy("HPLowSound_"..ply:EntIndex())
- return
- end
- surface.PlaySound("buttons/button17.wav")
- end)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement