Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- umsg.PoolString( "Send Damage" )
- local function EntityTakeDamage( ent, inf, atk, amt, info )
- umsg.Start( "Send Damage" )
- umsg.Vector( info:GetDamagePosition( ) )
- umsg.Float( amt )
- umsg.Long( info:GetDamageType( ) )
- umsg.End( )
- end
- hook.Add( "EntityTakeDamage", "Numbers.EntityTakeDamage", EntityTakeDamage )
- else
- local lbls = { }
- local function umGetDamage( um )
- local t = { }
- t.Pos = um:ReadVector( )
- t.Text = math.Round( um:ReadFloat( ) )
- t.DamageType = um:ReadLong( )
- t.DieTime = CurTime( ) + 4
- table.insert( lbls, t )
- end
- local red, green, blue, white, yellow
- red = Color( 255, 000, 000, 255 )
- green = Color( 000, 255, 000, 255 )
- blue = Color( 000, 000, 255, 255 )
- yellow = Color( 255, 255, 000, 255 )
- local function HUDPaint( )
- local k, v, p, c
- for k, v in pairs( lbls ) do
- if v.DieTime < CurTime( ) then
- lbls[ k ] = nil
- continue
- end
- p = v.Pos:ToScreen( )
- if not p.Visible then
- --Or whatever
- continue
- end
- if v.DamageType & DMG_BURN == DMG_BURN then
- c = red
- elseif v.DamageType & DMG_ACID == DMG_ACID then
- c = green
- elseif v.DamageType & DMG_SHOCK == DMG_SHOCK then
- c = blue
- elseif v.DamageType & DMG_BLAST == DMG_BLAST then
- c = yellow
- else
- c = white
- end
- draw.DrawText( v.Text, "ChatFont", p.x, p.y, c, TEXT_ALIGN_CENTER )
- end
- end
- usermessage.Hook( "Send Damage", umGetDamage )
- hook.Add( "HUDPaint", "Numbers.HUDPaint", HUDPaint )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement