[lua]
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
resource.AddFile( "sound/radio_mod_sounds/radio/custom/1.mp3" )
resource.AddFile( "sound/radio_mod_sounds/radio/custom/2.mp3" )
resource.AddFile( "sound/radio_mod_sounds/radio/custom/3.mp3" )
resource.AddFile( "sound/radio_mod_sounds/radio/custom/4.mp3" )
resource.AddFile( "sound/radio_mod_sounds/radio/custom/5.mp3" )
resource.AddFile( "sound/radio_mod_sounds/radio/custom/6.mp3" )
resource.AddFile( "sound/radio_mod_sounds/radio/custom/7.mp3" )
resource.AddFile( "sound/radio_mod_sounds/radio/custom/8.mp3" )
resource.AddFile( "materials/vgui/entities/sent_Radio3.vtf" )
resource.AddFile( "materials/vgui/entities/sent_Radio3.vmt" )
resource.AddFile( "materials/models/radio_electro.vtf" )
resource.AddFile( "materials/models/radio_electro.vmt" )
include('shared.lua')
--Radio music
ENT.RadioSong1 = NULL
ENT.RadioSong2 = NULL
ENT.RadioSong3 = NULL
ENT.RadioSong4 = NULL
ENT.RadioSong5 = NULL
ENT.RadioSong6 = NULL
ENT.RadioSong7 = NULL
ENT.RadioSong8 = NULL
ENT.SongNr = 0
ENT.NxtDelay = CurTime()
------------------------------------VARIABLES END
function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + tr.HitNormal * 16
local radio = ents.Create( 'sent_Radio3' )
radio:SetPos( SpawnPos )
radio:SetNetworkedString("Owner", "World")
radio:Spawn()
radio:Activate()
return radio
end
function ENT:Initialize( )
self:SetModel( "models/props_lab/citizenradio.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
local phys = self:GetPhysicsObject()
if(phys:IsValid()) then phys:Wake() end
self.Engine = NULL
self.RadioSong1 = CreateSound(self.Entity,"Radio_Mod_Sounds/Radio/custom/1.mp3")
self.RadioSong2 = CreateSound(self.Entity,"Radio_Mod_Sounds/Radio/custom/2.mp3")
self.RadioSong3 = CreateSound(self.Entity,"Radio_Mod_Sounds/Radio/custom/3.mp3")
self.RadioSong4 = CreateSound(self.Entity,"Radio_Mod_Sounds/Radio/custom/4.mp3")
self.RadioSong5 = CreateSound(self.Entity,"Radio_Mod_Sounds/Radio/custom/5.mp3")
self.RadioSong6 = CreateSound(self.Entity,"Radio_Mod_Sounds/Radio/custom/6.mp3")
self.RadioSong7 = CreateSound(self.Entity,"Radio_Mod_Sounds/Radio/custom/7.mp3")
self.RadioSong8 = CreateSound(self.Entity,"Radio_Mod_Sounds/Radio/custom/8.mp3")
end
--------------
function ENT:Use()
if self.NxtDelay < CurTime() then
self.NxtDelay = CurTime()+0.5
self.SongNr = self.SongNr + 1
self.Entity:EmitSound("buttons/lightswitch2.wav", 100, 100)
if self.SongNr >8 then
self.SongNr = 0
self.Entity:EmitSound("buttons/button18.wav", 100, 100)
end
end
end
-------------------
function ENT:Think()
if self.Entity:WaterLevel() > 0 then
local effectdata = EffectData()
effectdata:SetOrigin( self.Entity:GetPos())
effectdata:SetStart(Vector(0,0,2))
util.Effect( "PropellerBubbles", effectdata )
end
if self.SongNr == 0 then
self.RadioSong1:Stop()
self.RadioSong2:Stop()
self.RadioSong3:Stop()
self.RadioSong4:Stop()
self.RadioSong5:Stop()
self.RadioSong6:Stop()
self.RadioSong7:Stop()
self.RadioSong8:Stop()
end
if self.SongNr == 1 then
self.RadioSong1:Play()
end
if self.SongNr == 2 then
self.RadioSong1:Stop()
self.RadioSong2:Play()
end
if self.SongNr == 3 then
self.RadioSong2:Stop()
self.RadioSong3:Play()
end
if self.SongNr == 4 then
self.RadioSong3:Stop()
self.RadioSong4:Play()
end
if self.SongNr == 5 then
self.RadioSong4:Stop()
self.RadioSong5:Play()
end
if self.SongNr == 6 then
self.RadioSong5:Stop()
self.RadioSong6:Play()
end
if self.SongNr == 7 then
self.RadioSong6:Stop()
self.RadioSong7:Play()
end
if self.SongNr == 8 then
self.RadioSong7:Stop()
self.RadioSong8:Play()
end
end
-------------------
function ENT:OnRemove()
self.RadioSong1:Stop()
self.RadioSong2:Stop()
self.RadioSong3:Stop()
self.RadioSong4:Stop()
self.RadioSong5:Stop()
self.RadioSong6:Stop()
self.RadioSong7:Stop()
self.RadioSong8:Stop()
end
[/lua]
Thats crashing my friends game (Mine not :S)
Why?
mayby guve us erorr and shared.lua ?
I don't think we can do much with that code.
It could be his computer, it could be the script.
So, give us the script.
[QUOTE=Zeroi;25503271]I don't think we can do much with that code.
It could be his computer, it could be the script.
So, give us the script.[/QUOTE]
Thats the script.
And it happend to me too with this mod till i reinstalled my gmod.
Maybe thats mod problem?
Ah, I'm sorry.
I meant any errors.
And if you crash, it's probably the mod.
Outdated?
Well the mod is from 600days that what it saying on garrysmod my server well it on version 103
And the problem if i delete the radiomod it still wont work i have to reinstall my gmod / server (sometimes this and sometimes this) to make it work again -_- that so stupid
Do you get any errors? Try it.
Check error log, anything.
Any error would be helpful and we might fix this togheter.
I'm swear bro no errors
i think and that can sound stupid but it happens when i add the sv_downloadurl
I mean it worked great and all(today) and i played with a friends (we toghter reinstalled the gmod -_-)
I restarted added few things and sv_downloadurl
And it back (even after i deleted all)
But idk why i just thinkin it sv_downloadurl
You mean fastdl?
It also crashes my server.
Yea???? so i was right :D?
You didn't check for Client and server seperations(you cannot run AddCSLuaFile on the client for example).
Also you are playing sounds on Tick which is a bad idea.
Well so how i fixing it :S?
Sorry, you need to Log In to post a reply to this thread.