Lights

Hey guys, I was wondering, How would I make a SEnt that is cop car lights, reason: I wanna try and put them on Sakarias’s cop car.

taken directly from perp so its a perfect example
[lua]
// cl_init.lua
// Credits to hunts
local matLight = Material( “sprites/light_ignorez” )
local matBeam = Material( “effects/lamp_beam” )

ENT.RenderGroup = RENDERGROUP_TRANSLUCENT

include(‘shared.lua’)

function ENT:Initialize()

self.PixVis = util.GetPixelVisibleHandle()

self.Siren = CreateSound(self, Sound('perp/siren_long.mp3'));
self.WailSiren = CreateSound(self, Sound('perp/siren_wail.mp3'));
self.LastPlayTime = 0;
self.LastWailPlayTime = 0;
self.Time_Wail = SoundDuration('perp/siren_wail.mp3');
self.Time_Long = SoundDuration('perp/siren_long.mp3');

end

/---------------------------------------------------------
Name: Draw
---------------------------------------------------------
/
function ENT:Draw()

//self.BaseClass.Draw( self, true )

end

/---------------------------------------------------------
Name: Think
---------------------------------------------------------
/
function ENT:Think()
local Test1 = self:GetPos():ToScreen();
local Test2 = Vector(-44.1279, -42.3522, 62.4806):ToScreen();

if Test1.x == Test2.x and Test1.y == Test2.y then return false; end

if !self.Parent then
	local Closest = 99999;
	
	for k, v in pairs(ents.FindByClass('prop_vehicle_jeep')) do
		if v:GetModel() == 'models/copca2.mdl' and !v:GetTable().ChildrenRed then			
			local Dist = v:GetPos():Distance(self:GetPos());
				
			if Dist < Closest then					
				self.Parent = v;
				Closest = Dist;
			end
		end
	end
	
	if !self.Parent or !self.Parent:IsValid() then return; end
	
	self.Parent:GetTable().ChildrenRed = true;
end

if !self.Parent or !self.Parent:IsValid() then return; end
// soundszorz

if self.Parent:GetNetworkedBool('siren_sound', false) then
	if self.Parent:GetNetworkedBool('siren_sound_wail', false) then
		if self.LastPlayTime != 0 then
			self.Siren:Stop();
			self.LastPlayTime = 0;
		end
		
		if self.LastWailPlayTime + self.Time_Wail < CurTime() then
			self.WailSiren:Stop();
			self.WailSiren:Play();
			self.LastWailPlayTime = CurTime();
		end
	else
		if self.LastWailPlayTime != 0 then
			self.WailSiren:Stop();
			self.LastWailPlayTime = 0;
		end
	
		if self.LastPlayTime + self.Time_Long < CurTime() then
			self.Siren:Stop();
			self.Siren:Play();
			self.LastPlayTime = CurTime();
		end
	end
elseif !self.Parent:GetNetworkedBool('siren_sound', false) then
	if self.LastPlayTime != 0 then
		self.Siren:Stop();
		self.LastPlayTime = 0;
	end
	
	if self.LastWailPlayTime != 0 then
		self.WailSiren:Stop();
		self.LastWailPlayTime = 0;
	end
end
	
// lightzorz
if !self.Parent:GetNetworkedBool('siren_light', false) then return end

local r, b, Pos;
if math.Round(math.abs(math.cos(CurTime() * 10))) == 0 then
	r, b = 0, 255;
	Pos = self.Parent:LocalToWorld(Vector(-44.1279, -42.3522, 72.4806))
else
	r, b = 255, 0;
	Pos = self.Parent:LocalToWorld(Vector(-2.0009, -41.9132, 72.4320))
end

if !util.PixelVisible(Pos, 32, self.PixVis)	then return false; end

local dlight = DynamicLight( self:EntIndex() )
if ( dlight ) then
	dlight.Pos = Pos;
	dlight.r = r
	dlight.g = 0
	dlight.b = b
	dlight.Brightness = 15
	dlight.Decay = 1500
	dlight.Size = 512
	dlight.DieTime = CurTime()
end

local dlight = DynamicLight( self:EntIndex() )
if ( dlight ) then
	dlight.Pos = Pos;
	dlight.r = r
	dlight.g = 0
	dlight.b = b
	dlight.Brightness = 5
	dlight.Decay = 256
	dlight.Size = 1000
	dlight.DieTime = CurTime()
end

end

/---------------------------------------------------------
Name: DrawTranslucent
Desc: Draw translucent
---------------------------------------------------------
/
function ENT:DrawTranslucent()

end

/---------------------------------------------------------
Overridden because I want to show the name of the
player that spawned it…
---------------------------------------------------------
/
[/lua]

Where do I get the sound’s at? Also, so I just make a new sent and put this in the CL_init or w/e? I dont know.

ye just make a new sent and join it to the top of car and I dont have a copy of the sounds so I cant upload sorry

Can someone just like Export the cop car from the gamemode and upload it for me? :smiley: