Night_Wolf17

music-player [mp3shop]

Mar 20th, 2022
646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.72 KB | None | 0 0
  1. @name mp3shop_d03_y22
  2. @inputs W:wirelink
  3. @outputs
  4. @persist [ArtName SongName DLPlay]:table PP
  5. @trigger
  6.    
  7.     O = owner()
  8.     E = entity()
  9.     W = entity():isWeldedTo():wirelink()
  10.     Cmd = O:lastSaid():explode("#"):string(2)
  11.     if(chatClk(O))
  12.     {
  13.         switch(O:lastSaid())
  14.         {
  15.             case"#"+Cmd,
  16.                 hideChat(1)
  17.                 httpRequest("https://mp3store.cc/get-search/"+Cmd)
  18.                 W:egpSetText(105,Cmd)
  19.             break
  20.         }
  21.     }
  22.     if(httpClk())
  23.     {
  24.         Data = httpData()
  25.         local Sub = httpUrlDecode("%D0%A1%D0%BB%D1%83%D1%88%D0%B0%D1%82%D1%8C")
  26.         ArtName = Data:gmatch("<div class%=\"music%-info\"><b>(.-)%<%/")
  27.         SongName = Data:gmatch("</b>(.-)</")
  28.         DLPlay = Data:gmatch("class%=\"music%-load\" href%=\"(.-)\"")
  29.        
  30.         for(I=1,10) {
  31.             local A = ArtName[I+1,array]
  32.             local B = SongName[I+1,array]
  33.             local DL = DLPlay[I+1,array]
  34.            
  35.             W:egpSetText(30+I,A:string(1)+" - "+httpUrlDecode(B:string(1):sub(0,30)))
  36.             W:egpColor(I,vec(25))
  37.         }
  38.     }
  39.     if(first())
  40.     {
  41.         E:setAlpha(0)
  42.         W:egpClear()
  43.        
  44.         W:egpRoundedBox(99,vec2(256,256),vec2(516,516))
  45.         W:egpColor(99,vec())
  46.  
  47.         W:egpRoundedBox(100,vec2(256,20),vec2(516,64))
  48.         W:egpColor(100,vec(25))
  49.         W:egpMaterial(100,"gui/gradient_down")        
  50.        
  51.         W:egpRoundedBox(101,vec2(256,490),vec2(516,64))
  52.         W:egpColor(101,vec(25))
  53.         W:egpMaterial(101,"gui/gradient_up")
  54.  
  55.         W:egpBox(102,vec2(290,70),vec2(300,32)) # SearchBox
  56.         W:egpColor(102,vec(200))
  57.  
  58.         W:egpText(103,"MP3",vec2(24,57))
  59.         W:egpFont(103,"Trebuche24",24)
  60.         W:egpColor(103,vec(255,0,0))
  61.        
  62.         W:egpText(104,"STORE",vec2(68,57))
  63.         W:egpFont(104,"Trebuche24",24)
  64.  
  65.         W:egpText(105,"type in chat # song",vec2(150,57))
  66.         W:egpFont(105,"Helvetica",24)
  67.         W:egpColor(105,vec(5))
  68.  
  69.         W:egpText(106,"MP3-Shop Player by Arkiss[20.03.2022]",vec2(256,485))
  70.         W:egpFont(106,"Helvetica",16)
  71.         W:egpColor(106,vec(150,50,0))
  72.                
  73.         function wirelink:inBox(Index:number)
  74.         {
  75.             local Pos = This:egpPos(Index)
  76.             local Size = This:egpSize(Index)
  77.             local Cur = round(This:egpCursor(owner()))
  78.             local Use = owner():keyUse()
  79.            
  80.             if(inrange(Cur,Pos - Size/2,Pos + Size/2))
  81.             {
  82.                 This:egpColor(Index,vec(50))
  83.                 if(changed(Use)&Use)
  84.                 {
  85.                     This:egpColor(Index,vec(150))
  86.                     local URL = DLPlay[Index,array]
  87.                     soundURLdelete("ark")
  88.                     soundURLPurge()
  89.                     soundURLload("ark","https://mp3store.cc"+URL:string(1),100,0,entity())
  90.                     soundPlay("pl",0,"ui/buttonclickrelease.wav")
  91.                     W:egpSetText(105,ArtName[Index+1,array][1,string]+" - "+SongName[Index+1,array][1,string])
  92.                 }
  93.             }
  94.             else
  95.             {
  96.                 This:egpColor(Index,vec(25))
  97.             }
  98.         }
  99.        
  100.         for(I=1,10)
  101.         {
  102.             W:egpBox(I,vec2(256,90+I*35),vec2(512,32))
  103.             W:egpColor(I, vec(25))
  104.         }
  105.         for(I=1,10)
  106.         {
  107.             W:egpText(30+I,"",vec2(20,78+I*35))
  108.             W:egpFont(30+I,"Helvetica",24)
  109.             W:egpColor(30+I,vec(200))
  110.         }        
  111.         soundURLdelete("ark")
  112.         soundURLPurge()
  113.            
  114.         runOnChat(1) runOnHTTP(1)
  115.         E:setName("mp3shop_player by Arkiss")
  116.     }
  117.         interval(100)
  118.     for(I=1,ArtName:count()){ W:inBox(I) }
  119.  
Advertisement
Add Comment
Please, Sign In to add comment