All pastes #2048505 Raw Edit

Stuff

public text v1 · immutable
#2048505 ·published 2011-04-20 02:13 UTC
rendered paste body
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
 
ENT.PrintName 		= "Item C4"
ENT.Author 			= "Acruid"
ENT.Contact			= "http://www.egigaming.com"
ENT.Purpose			= "removing Walls"
ENT.Instructions	= "Look at a wall and place for a suprise!"

ENT.Spawnable 		= false
ENT.AdminSpawnable 	= false

if SERVER then return; end

local defuseTime = 66*5 // this is in server ticks, lag will make this longer than it is

local function drawDisarm()

	for k,v in pairs( ents.FindByClass("sent_c4") ) do
		local Time = v:GetNWInt("DefuseTimer")
		if  Time < defuseTime and Time > 0 then
			local self = v
			local entPos = self:GetPos():ToScreen();
	
			local w = ScrW()
			local h = ScrH()
			local x,y,width,height = entPos.x-(w/10)/2, entPos.y-(h/25)/2+20, w/10, h/25
			draw.RoundedBox(8, x, y, width, height, Color(10,10,10,120))

			local time = defuseTime
			local curtime = defuseTime - Time
			local status = curtime/time
			local BarWidth = status * (width - 16) + 8
			draw.RoundedBox(8, x+8, y+8, BarWidth, height - 16, Color(255-(status*255), 0+(status*255), 0, 255))
			
			draw.SimpleText("Defusing Bomb", "Trebuchet18", entPos.x, entPos.y+20, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
		end
	end
end
hook.Add( "HUDPaint", "C4DisarmProgress", drawDisarm )