[Grappling hook 3.4*fixed*] Invisible rope problem

Okay so I’m having a tough time establishing the cause for the problem I’m facing. I’m using the following grappling hook swep:

I’ll try to explain the situation as best as I can. In the cl_init.lua for the trace1 entity there is a function that creates and draws another players rope when they use the grappling hook. The shared.lua in the swep itself calls on this function, from what I can see at least, whenever a player uses the grappling hook. So what’s happening is this: Whenever a person uses their grappling hook, they themselves can see their rope in first person view. But in world view, their rope isn’t being drawn. Since the rope isn’t being properly drawn by the trace1 entity, players can’t see the ropes of other players. Since this is happening, anyone who uses a grappling hook appears to be floating/noclipping to other players. In reality they are using a grappling hook, but the rope is just not being drawn by the server for other players to see.

Below is the code for both files:
Shared.lua for the SWEP itself:


SWEP.Author			= "Hxrmn, HOLOGRAPHICpizza"
SWEP.Contact		= "mcraft@peak15.org"
SWEP.Purpose		= "A Grappling Hook"
SWEP.Instructions	= "Left click to fire"

SWEP.Base				= "weapon_tttbase"
SWEP.Spawnable			= true
SWEP.AdminSpawnable		= false
SWEP.AutoSpawnable		= false
SWEP.PrintName			= "Grappling Hook"			
SWEP.Slot				= 7
SWEP.SlotPos			= 0
SWEP.DrawAmmo			= false
SWEP.DrawCrosshair		= false

SWEP.ViewModel			= "models/weapons/v_pist_deagle.mdl"
SWEP.WorldModel			= "models/weapons/w_pist_deagle.mdl"

local sndPowerUp		= Sound("weapons/crossbow/hit1.wav")
local sndPowerDown		= Sound("Airboat.FireGunRevDown")
local sndTooFar			= Sound("buttons/button10.wav")

function SWEP:Initialize()

	nextshottime = CurTime()
	self:SetWeaponHoldType( "smg" )
	self.zoomed = false
	
end

function SWEP:Think()

	if (!self.Owner || self.Owner == NULL) then return end
	
	if ( self.Owner:KeyPressed( IN_ATTACK ) ) then
	
		self:StartAttack()
		
	elseif ( self.Owner:KeyDown( IN_ATTACK ) && inRange ) then
	
		self:UpdateAttack()
		
	elseif ( self.Owner:KeyReleased( IN_ATTACK ) && inRange ) then
	
		self:EndAttack( true )
	
	end
	
	--Changed from KeyDown to prevent random stuck-in-zoom bug.
	if ( self.Owner:KeyPressed( IN_ATTACK2 ) ) then
	
		self:Attack2()
		
	end

end

function SWEP:DoTrace( endpos )
	local trace = {}
		trace.start = self.Owner:GetShootPos()
		trace.endpos = trace.start + (self.Owner:GetAimVector() * 14096) --14096 is length modifier.
		if(endpos) then trace.endpos = (endpos - self.Tr.HitNormal * 7) end
		trace.filter = { self.Owner, self.Weapon }
		
	self.Tr = nil
	self.Tr = util.TraceLine( trace )
end

function SWEP:StartAttack()
	-- Get begining and end poins of trace.
	local gunPos = self.Owner:GetShootPos() -- Start of distance trace.
	local disTrace = self.Owner:GetEyeTrace() -- Store all results of a trace in disTrace.
	local hitPos = disTrace.HitPos -- Stores Hit Position of disTrace.
	
	-- Calculate Distance
	-- Thanks to rgovostes for this code.
	local x = (gunPos.x - hitPos.x)^2;
	local y = (gunPos.y - hitPos.y)^2;
	local z = (gunPos.z - hitPos.z)^2;
	local distance = math.sqrt(x + y + z);
	
	-- Only latches if distance is less than distance CVAR, or CVAR negative
	local distanceCvar = GetConVarNumber("grapple_distance")
	inRange = false
	if distanceCvar < 0 or distance <= distanceCvar then
		inRange = true
	end
	
	if inRange then
		if (SERVER) then
			
			if (!self.Beam) then -- If the beam does not exist, draw the beam.
				-- grapple_beam
				self.Beam = ents.Create( "trace1" )
					self.Beam:SetPos( self.Owner:GetShootPos() )
				self.Beam:Spawn()
			end
			
			self.Beam:SetParent( self.Owner )
			self.Beam:SetOwner( self.Owner )
		
		end
		
		self:DoTrace()
		self.speed = 10000 -- Rope latch speed. Was 3000.
		self.startTime = CurTime()
		self.endTime = CurTime() + self.speed
		self.dtime = -1
		
		if (SERVER && self.Beam) then
			self.Beam:GetTable():SetEndPos( self.Tr.HitPos )
		end
		
		self:UpdateAttack()
		
		self.Weapon:EmitSound( sndPowerDown )
	else
		-- Play a sound
		self.Weapon:EmitSound( sndTooFar )
	end
end

function SWEP:UpdateAttack()

	self.Owner:LagCompensation( true )
	
	if (!endpos) then endpos = self.Tr.HitPos end
	
	if (SERVER && self.Beam) then
		self.Beam:GetTable():SetEndPos( endpos )
	end

	lastpos = endpos
	
	
			if ( self.Tr.Entity:IsValid() ) then
			
					endpos = self.Tr.Entity:GetPos()
					if ( SERVER ) then
					self.Beam:GetTable():SetEndPos( endpos )
					end
			
			end
			
			local vVel = (endpos - self.Owner:GetPos())
			local Distance = endpos:Distance(self.Owner:GetPos())
			
			local et = (self.startTime + (Distance/self.speed))
			if(self.dtime != 0) then
				self.dtime = (et - CurTime()) / (et - self.startTime)
			end
			if(self.dtime < 0) then
				self.Weapon:EmitSound( sndPowerUp )
				self.dtime = 0
			end
			
			if(self.dtime == 0) then
			zVel = self.Owner:GetVelocity().z
			vVel = vVel:GetNormalized()*(math.Clamp(Distance,0,7))
				if( SERVER ) then
				local gravity = GetConVarNumber("sv_Gravity")
				vVel:Add(Vector(0,0,(gravity/100)*1.5)) -- Player speed. DO NOT MESS WITH THIS VALUE!
				if(zVel < 0) then
					vVel:Sub(Vector(0,0,zVel/100))
				end
				self.Owner:SetVelocity(vVel)
				end
			end
	
	endpos = nil
	
	self.Owner:LagCompensation( false )
	
end

function SWEP:EndAttack( shutdownsound )
	
	if ( shutdownsound ) then
		self.Weapon:EmitSound( sndPowerDown )
	end
	
	if ( CLIENT ) then return end
	if ( !self.Beam ) then return end
	
	self.Beam:Remove()
	self.Beam = nil
	
end

function SWEP:Attack2() -- Zoom.
	if self.zoomed then
		self.zoomed = false
		if SERVER then
			self.Owner:SetFOV(0, 0.1)
		end
	else
		self.zoomed = true
		if SERVER then
			self.Owner:SetFOV(30, 0.1)
		end
	end
end

function SWEP:Holster()
	self:EndAttack( false )
	return true
end

function SWEP:OnRemove()
	self:EndAttack( false )
	return true
end


function SWEP:PrimaryAttack()
end

function SWEP:SecondaryAttack()
end

cl_init.lua for the trace1 entity


include('shared.lua')

//local matBeam		 		= Material( "egon_middlebeam" )
local matBeam		 		= Material( "cable/rope" )
//local matLight 				= Material( "sprites/gmdm_pickups/light" )
//local matRefraction			= Material( "egon_ringbeam" )
//local matRefractRing		= Material( "refract_ring" )
//local matHook				= Material( "sprites/gmdm_pickups/light" )
//local hookTex = Texture:Download("sprites/yellowglow1")
//matHook:SetMaterialTexture( hookTex )

/*---------------------------------------------------------
   Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()		

	self.Size = 0
	self.MainStart = self.Entity:GetPos()
	self.MainEnd = self:GetEndPos()
	self.dAng = (self.MainEnd - self.MainStart):Angle()
	//Changed from 3000 to match hook speed.
	self.speed = 10000
	self.startTime = CurTime()
	self.endTime = CurTime() + self.speed
	self.dtime = -1
	
end

function ENT:Think()

	self.Entity:SetRenderBoundsWS( self:GetEndPos(), self.Entity:GetPos(), Vector()*8 )
	
	self.Size = math.Approach( self.Size, 1, 10*FrameTime() )
	
end


function ENT:DrawMainBeam( StartPos, EndPos, dtime, dist )
	
	local TexOffset = 0//CurTime() * -2.0
	
	local ca = Color(255,255,255,255)
	//local dist = EndPos:Distance(StartPos)
	//self.endTime - self.startTime)
	//self.endTime - 
	
	// I found the console spam! WTF was this for?
	//Msg(dtime .. "
")
	
	EndPos = StartPos + (self.dAng * ((1 - dtime)*dist))
	//StartPos = StartPos + (self.dAng * (((1 - dtime)*dist)-3))
	
	// Cool Beam
	render.SetMaterial( matBeam )
	render.DrawBeam( EndPos, StartPos, 
	//32
					2, 
					TexOffset*-0.4, TexOffset*-0.4 + StartPos:Distance(EndPos) / 256, 
					ca )


end

function ENT:Draw()

	local Owner = self.Entity:GetOwner()
	if (!Owner || Owner == NULL) then return end

	local StartPos 		= self.Entity:GetPos()
	local EndPos 		= self:GetEndPos()
	local ViewModel 	= Owner == LocalPlayer()
	local vm1 = Owner:GetViewModel()
	local vm2 = Owner:GetActiveWeapon()
	
	if (EndPos == Vector(0,0,0)) then return end
	
	-- If it's the local player we start at the viewmodel
	if ( ViewModel ) then
	     
		local vm1 = Owner:GetViewModel()
		if (!vm1 || vm1 == NULL) then return end 
		local attachment = vm1:GetAttachment(1)
		if attachment then
		StartPos = attachment.Pos
	else
	-- If we're viewing another player we start at their weapon
	
		local vm2 = Owner:GetActiveWeapon()
		if (!vm2 || vm2 == NULL) then return end
		local attachment = vm2:GetAttachment(1)
		if attachment then
		StartPos = attachment.Pos
	
	end
end	
	-- offset the texture coords so it looks like it's scrolling
	local TexOffset = CurTime() * -2
	
	-- Make the texture coords relative to distance so they're always a nice size
	local Distance = EndPos:Distance( StartPos ) * self.Size

	local et = (self.startTime + (Distance/self.speed))
	if(self.dtime != 0) then
		self.dtime = (et - CurTime()) / (et - self.startTime)
	end
	if(self.dtime < 0) then
		self.dtime = 0
	end
	self.dAng = (EndPos - StartPos):Angle():Forward()

	gbAngle = (EndPos - StartPos):Angle()
	local Normal 	= gbAngle:Forward()

	-- Draw the beam
	self:DrawMainBeam( StartPos, StartPos + Normal * Distance, self.dtime, Distance )

//	if (ViewModel) then
//		render.IgnoreZ( true )
//	end	
	
//	render.SetMaterial( matHook )
//	if(self.dtime == 0) then
//		render.DrawSprite( EndPos + Normal, 44, 44, Color( 255, 255, 255, self.Size * 255 ) )
//	else
//		EndPos = StartPos + (self.dAng * ((1 - self.dtime)*Distance))
//		render.DrawSprite( EndPos, 44, 44, Color( 120, 120, 255, self.Size * 255 ) )		
//	end
	
//	render.SetMaterial( matLight )
//	render.DrawSprite( StartPos, 28, 28, Color( 255, 255, 255, 255 * self.Size ) )
//	render.DrawSprite( StartPos, 64, 64, Color( 255, 255, 255, 255 * self.Size ) )
	// + Normal * 32
	
//	if (ViewModel) then
//		render.IgnoreZ( false )
//	end
	 
end
end
/*---------------------------------------------------------
   Name: IsTranslucent
---------------------------------------------------------*/
function ENT:IsTranslucent()
	return true
end


I was wondering if anyone had any clue how to fix this?