Respawning doors

Hi I want to know if there is some code I need to add to my door charge so that when it blows down doors the doors respawna after like 20 seconds. I have seen this feature in other server it’s just I’m not sure what to do. Here is the code for the shared.lua

SWEP.Author = “Annoyed Tree”
SWEP.Contact = “”
SWEP.Purpose = “”
SWEP.Instructions = “”

SWEP.Spawnable = true
SWEP.AdminSpawnable = false

SWEP.ViewModel = “models/weapons/v_c4.mdl”
SWEP.WorldModel = “models/weapons/w_c4.mdl”

SWEP.Primary.ClipSize = 1
SWEP.Primary.DefaultClip = 2
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = “none”
SWEP.Primary.Delay = 1

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = “none”

function SWEP:Initialize( )

if ( SERVER ) then

	self:SetWeaponHoldType( self.HoldType )
	
end

end

function SWEP:Think()

end

function SWEP:Reload()

end

function SWEP:PrimaryAttack( )

local tr = self.Owner:GetEyeTrace( )

if ( tr.Entity:GetClass( ) == "prop_door_rotating" && tr.Entity:GetPos( ):Distance( self.Owner:GetPos( ) ) < 100 ) then
	
	self.Owner:PrintMessage( 4, "CHARGE SET" )
	
	tr.Entity:EmitSound( "npc/turret_floor/deploy.wav" )
	
	if ( SERVER ) then
	
		local ent = ents.Create( "prop_dynamic_override" )

		ent:SetModel( "models/Items/CrossbowRounds.mdl" ) 

		ent:SetPos( tr.HitPos )
		ent:SetAngles( tr.Entity:GetAngles( ) + Angle( 0, 90, 0 ) )

		ent:SetMoveType( MOVETYPE_NONE )
		ent:SetSolid( SOLID_VPHYSICS )
	
		ent:SetParent( tr.Entity )

		ent:Spawn( ) 
	
		timer.Simple( 1, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
		timer.Simple( 2, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
		timer.Simple( 3, function( ) ent:EmitSound( "hl1/fvox/beep.wav" ) end )
	
		timer.Simple( 4, function( ) 
	
			local door = ents.Create( "prop_physics" )
		
			door:SetModel( tr.Entity:GetModel( ) )
		
			door:SetPos( tr.Entity:GetPos( ) )
			door:SetAngles( tr.Entity:GetAngles( ) )
		
			door:SetSkin( tr.Entity:GetSkin( ) )
		
			door:Spawn( ) 
		
			door:GetPhysicsObject( ):SetVelocity( self.Owner:GetPos( ) + self.Owner:GetForward( ) * 10373 )
		
			local explode = ents.Create( "env_explosion" )
		
			explode:SetKeyValue( "spawnflags", 128 )
			explode:SetPos( tr.Entity:GetPos( ) )
			
			explode:Spawn( )
			
			explode:Fire( "explode", "", 0 )
			
			ent:Remove( )
			tr.Entity:Remove( )
	
		end )
		
	end
	
end

//self:TakePrimaryAmmo( 1 )

end

function SWEP:SecondaryAttack( )

end

function SWEP:Holster( )

return true

end

Extract and look at the code in this:

Sorry for this being a week old reply but I just got time to check on that (been doing A LOT of stuff lately) and it really did not help. I mean that addon allows doors to be destroyed and it respawns except I still don’t know what I would do with the addon. Also I need doors to respawn because of my door charge which using explosives. Except the addons says explosives won’t work so that’s out of the question. I looked in it’s code and really did not find anything that would help me. The code in there was for the addon. I still need to know if I need to add some code to the door charge or if I do something else, thanks for anyone who has and will respond.

could SetNoDraw it and disable collisions and the ability to “Use” it (I believe Use doesnt work on entities that you are nocollided with)

[editline]21st October 2014[/editline]

sorry, i should of been more clear: instead of removing the entity, just Entity:SetNoDraw(true) it, disable collisions (forget function) and that should prevent Use, and make it look like its disappeared.

Ok thanks.