Hello, how would I go about making blood spill on your screen when you get shot/damaged in-game?

I went back through a couple threads, someone had the same question as I did, but not for Trouble in Terrorist Town.

The code is from Zombie Onslaught:

[lua]

function GM:HUDPaint()

self.BaseClass:HUDPaint()

```
GAMEMODE:OnHUDPaint()
```

end

function GM:OnHUDPaint()

GAMEMODE:PaintBlood()

end

function GM:PaintBlood()

```
if #Stains < 1 then return end
for k,v in pairs( Stains ) do
v.Alpha = math.Approach( v.Alpha, 0, FrameTime() * v.DieRate * -1 )
surface.SetTexture( v.Mat )
surface.SetDrawColor( 255, 10, 10, v.Alpha )
surface.DrawTexturedRectRotated( v.X, v.Y, v.W, v.H, v.Rotation )
end
for k,v in pairs( Stains ) do
if v.Alpha < 2 then
table.remove( Stains, k )
elseif not LocalPlayer():Alive() then
v.DieRate = 30
end
end
```

end

function AddStain()

local x, y, w, h = ScrW() * math.Rand(-0.2,1), ScrH() * math.Rand(-0.2,1), ScrW() * math.Rand(0.3,0.6), ScrH() * math.Rand(0.3,0.6)

table.insert( Stains, {X = x, Y = y, W = w, H = h, Mat = table.Random( StainMats ), DieRate = math.Rand(5,15), Rot = math.random(0,360), Alpha = math.random(50,150)} )

end

[/lua]

I added this to my “cl_hud.lua” but only resulted in the error

```
ERROR: GAMEMODE:'HUDPaint' Failed: [terrortown\gamemode\cl_hud.lua:362] attempt to get length of global 'Stains' (a nil value)
```

The similar thread is at http://forum.facepunch.com/showthread.php?t=1183293