I am having trouble with my portal radio because it will not stop the sound after it is removed:
[LUA]AddCSLuaFile()
DEFINE_BASECLASS( "base_anim" )
ENT.PrintName = "Portal Radio"
ENT.Author = "buster925"
ENT.Information = "The radio from Portal"
ENT.Category = "Portal"
ENT.Editable = false
ENT.Spawnable = true
ENT.AdminOnly = false
function ENT:SpawnFunction( ply, tr, ClassName )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local ent = ents.Create( ClassName )
ent:SetPos( SpawnPos )
ent:Spawn()
ent:Activate()
return ent
end
function ENT:Initialize()
self:SetModel( "models/radio_reference.mdl" )
self:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
self:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics
self:SetSolid( SOLID_VPHYSICS ) -- Toolbox
self:EmitSound("looping_radio_mix.wav", 80, 100)
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:OnRemove()
self:StopSound("looping_radio_mix.wav")
end
function ENT:Use( activator, caller )
return
end
function ENT:Think()
-- We don't need to think, we are just a prop after all!
end[/LUA]
I am also having problems with the physbeam going to where it started instead of where it is.
Sorry, you need to Log In to post a reply to this thread.