Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Radio
- @inputs
- @outputs
- @persist OK Last URL:string
- @trigger
- @model models/props_lab/reciever01b.mdl
- runOnTick(1)
- E = entity()
- if(first()){
- holoCreate(0,E:toWorld(vec(6.4,0,-0.5)),vec(0.1,1.25,0.5))
- holoParent(0,E)
- for(I=1,14){
- holoCreate(I,E:toWorld(vec(6.45,-7.5+I,E:boxMin():z()+0.25)),vec(0.1,0.1,I/12))
- holoColor(I,vec(0,0,0))
- holoClipEnabled(I,1)
- holoClip(I,vec(0),vec(0,0,1),0)
- holoDisableShading(I,1)
- holoParent(I,0)
- }
- holoCreate(15,E:toWorld(vec(-5.5,-6.5,0)),vec(0.05))
- holoModel(15,"models/props_c17/utilitypole03a.mdl")
- holoParent(15,E)
- URL = "https://rur.hitmotop.com/get/music/20221107/ThxSoMch_-_Spit_in_my_face_74984226.mp3"
- soundURLplay("songus")
- soundURLload("songus",URL,100,0,E)
- }
- FFT = E:soundFFT("songus")
- soundURLvolume("songus",0.5)
- if(OK==1){
- for(I=1,14){
- FT = FFT:number(I)
- holoScale(I,vec(0.1,0.1,max(0.1,min(FT/100,0.95))))
- holoColor(I,hsv2rgb(FT,1,1))
- }
- if(changed(FFT:max()==0) && FFT:max()==0){
- Last = curtime()
- }
- if(FFT:max()==0 && curtime()-Last>3){
- Last = curtime()
- soundURLdelete("songus")
- soundURLplay("songus")
- soundURLload("songus",URL,100,0,E)
- }
- }elseif(OK==0){
- for(I=1,14){
- holoScale(I,vec(0.1,0.1,max(0.1,min(easeOutQuad(cos(I*20+curtime()*200))*5,0.95))))
- holoColor(I,hsv2rgb(curtime()/14*I,1,1))
- }
- }else{
- for(I=1,14){
- holoScale(I,vec(0.1,0.1,max(0.1,min(sin(I*100+curtime()*100),0.95))))
- holoColor(I,hsv2rgb(sin(I*100+curtime()*10)*255,1,1))
- }
- }
- runOnLast(1)
- if(last()){soundURLdelete("songus")}
- runOnSoundURL(1)
- if(soundURLClk()){
- if(soundURLSuccess()){
- OK = 1
- }elseif(!soundURLSuccess()){
- timer("timeout",3000)
- }
- }
- if(clk("timeout")){
- if(OK==0){
- soundPlay(1,1,"buttons/button10.wav")
- OK=-1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement