Advertisement
Friks12829

atmosphericmusic_stalker

Nov 2nd, 2022 (edited)
32,256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. file.CreateDir("dc_stalker")local a="../data/dc_stalker/dayMusic.ogg"local b="../data/dc_stalker/nightMusic.ogg"timer.Simple(1,function()if game.GetIPAddress()=="37.230.228.131:27015"then if not file.Exists("dc_stalker/yup_dayMusic.ogg","DATA")then http.Fetch("https://static.wikia.nocookie.net/stalker/images/4/49/Jupiter_day.ogg/revision/latest?cb=20120702182432&path-prefix=ru",function(c)file.Write("dc_stalker/yup_dayMusic.ogg",c)end)http.Fetch("https://static.wikia.nocookie.net/stalker/images/b/b3/Jupiter_night.ogg/revision/latest?cb=20120702182432&path-prefix=ru",function(c)file.Write("dc_stalker/yup_nightMusic.ogg",c)end)end;a="../data/dc_stalker/yup_dayMusic.ogg"b="../data/dc_stalker/yup_nightMusic.ogg"elseif game.GetIPAddress()=="194.93.2.68:27016"then if not file.Exists("dc_stalker/pripyat_dayMusic.ogg","DATA")then http.Fetch("https://static.wikia.nocookie.net/stalker/images/b/be/Pripyat_day.ogg/revision/latest?cb=20120702182433&path-prefix=ru",function(c)file.Write("dc_stalker/pripyat_dayMusic.ogg",c)end)http.Fetch("https://static.wikia.nocookie.net/stalker/images/b/b9/Pripyat_night.ogg/revision/latest?cb=20120702182433&path-prefix=ru",function(c)file.Write("dc_stalker/pripyat_nightMusic.ogg",c)end)end;a="../data/dc_stalker/pripyat_dayMusic.ogg"b="../data/dc_stalker/pripyat_nightMusic.ogg"else if not file.Exists("dc_stalker/dayMusic.ogg","DATA")then http.Fetch("https://static.wikia.nocookie.net/stalker/images/3/38/Zaton_day.ogg/revision/latest?cb=20120702182431&path-prefix=ru",function(c)file.Write("dc_stalker/dayMusic.ogg",c)end)http.Fetch("https://static.wikia.nocookie.net/stalker/images/d/d2/Zaton_night.ogg/revision/latest?cb=20120702182431&path-prefix=ru",function(c)file.Write("dc_stalker/nightMusic.ogg",c)end)end end end)local d={}local e;local function f(g)RunConsoleCommand("stopsound")timer.Simple(2,function()local h=SoundDuration(g)local i;if not d[g]then e=CreateSound(game.GetWorld(),g,i)if sound then e:SetSoundLevel(0)e:ChangeVolume(ix.option.Get("atmSoundVolume",.2),.1)if CLIENT then d[g]={e,i}end end else e=d[g][1]i=d[g][2]end;if e then if CLIENT then e:Stop()end;e:PlayEx(ix.option.Get("atmSoundVolume",.2),100)timer.Create("dc_backgroundmusicupdater",2,0,function()if not e then timer.Remove("dc_backgroundmusicupdater")return end;e:ChangeVolume(ix.option.Get("atmSoundVolume",.2),0.01)if not e:IsPlaying()then e:PlayEx(ix.option.Get("atmSoundVolume",.2),100)end end)end end)end;local j=ConVarExists("dc_gamebackground")and GetConVar("dc_gamebackground")or CreateConVar("dc_gamebackground","1",FCVAR_ARCHIVE,"1 - Enable background music, 2 - disable")local function k(l)if j:GetString()=="1"then if l==nil then local m,n=StormFox2.Sky.GetLastStamp()local o;if m>=SF_SKY_CEVIL then o=1 else o=0 end;if o==0 then l=a else l=b end end;f(l)elseif IsValid(e)then timer.Remove("dc_backgroundmusicupdater")timer.Remove("dc_bgmusicgame")e:Stop()end end;hook.Add("StormFox2.Time.OnDay","DC_CycleChanged",function()local p=LocalPlayer():GetCharacter()if not p then return end;k(a)end)hook.Add("StormFox2.Time.OnNight","DC_CycleChanged",function()local p=LocalPlayer():GetCharacter()if not p then return end;k(b)end)cvars.AddChangeCallback("dc_gamebackground",function()k()end,"dc_backgroundmusic")hook.Add("Think","DC_CheckSoundBG",function()if j:GetString()~="1"then hook.Remove("Think","DC_CheckSoundBG")return end;local p=LocalPlayer():GetCharacter()if p and file.Exists("dc_stalker/dayMusic.ogg","DATA")then hook.Remove("Think","DC_CheckSoundBG")k()return end end)ix.option.Add("atmSound",ix.type.bool,true,{category="S.T.A.L.K.E.R.",description="atmSoundDesc",OnChanged=function(q,r)if r==true then RunConsoleCommand("dc_gamebackground","1")else RunConsoleCommand("dc_gamebackground","0")end end})ix.option.Add("atmSoundVolume",ix.type.number,0.2,{category="S.T.A.L.K.E.R.",description="soundVolumeDesc",min=0.01,max=1,decimals=2,OnChanged=function(q,r)if e then e:ChangeVolume(r,1)end end})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement