Advertisement
Guest User

asd

a guest
Jul 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. @name Bmans Youtube Player
  2. @trigger
  3. @persist [Auth Que MRP MRS Quep QueIP]:array SP RQ RTC CS:string CSR:entity
  4. if(first()){
  5. runOnTick(1)
  6. runOnChat(1)
  7. runOnHTTP(1)
  8. streamDisable3D(1)
  9. Volume = 1.0
  10. holoCreate(1)
  11. holoParent(1,entity())
  12. holoModel(1, "models/props_lab/citizenradio.mdl")
  13. holoAnim(1, "act_gmod_taunt_dance")
  14. timer("dance", holoAnimLength(1) * 945)
  15. Auth:pushEntity(owner())
  16. }
  17.  
  18. interval(300)
  19. if(first()){
  20. runOnChat(1)
  21. runOnHTTP(1)
  22. #runOnLast(1)
  23. E=entity()
  24. O=owner()
  25. }
  26. if(chatClk()){
  27. LS=lastSaid()
  28. LSP=lastSpoke()
  29. if(LS:sub(1,5)=="!add "){
  30. FP=findPlayerByName(LS:sub(6, LS:length()))
  31. hint("Allowed user: "+FP:name(),1000)
  32. Auth:pushEntity(FP)
  33. print(Auth:count())
  34. }
  35.  
  36. if(LS:sub(1,8)=="!remove "){
  37. FP=findPlayerByName(LS:sub(9, LS:length()))
  38. hint("removed user: "+FP:name(),1000)
  39. foreach(K,RP:entity=Auth){
  40. if(RP==Auth[K,entity]){Auth:remove(K)}
  41. }
  42. print(Auth:count())
  43. }
  44.  
  45. A=LS:explode(" ")
  46. if (A[1,string]=="!youtube")
  47. {
  48.  
  49. foreach(K,Au:entity=Auth){
  50. if(Au==LSP){
  51. LSP:sendMessageColor("link added to Que, your link has "+Que:count()+" song/s in front of it!")
  52. #httpRequest("http://michaelbelgium.me/ytconverter/convert.php?youtubelink="+A[2,string])
  53. print("user: "+LSP:name()+" requesting "+A[2,string])
  54. Que:pushString(A[2,string])
  55. QueIP:pushNumber(0)
  56. Quep:pushEntity(LSP)
  57. break
  58. }
  59. }
  60. }
  61. if(LS:sub(1,7) == "!volume"){
  62. hideChat(1)
  63. owner():sendMessage("Changed current station's volume to "+lastSaid():sub(9):toNumber())
  64. soundURLvolume(1,lastSaid():sub(9):toNumber()/100)
  65. }
  66. if(LS=="!skip"&LSP==owner()){
  67. SP=0
  68. stoptimer("song_over")
  69. timer("song_over",100)
  70. print("skipping song requested by: "+CSR:name())
  71. foreach(K,Ss:string=Que){
  72. if(Ss==CS){
  73. Que:remove(K)
  74. Quep:remove(K)
  75. print("removed additional entry of same song!")
  76. }
  77. }
  78. }
  79. if (A[1,string]=="!yt"){
  80. moneyRequest(LSP,2000,"payment for song request")
  81. MRP:pushEntity(LSP)
  82. MRS:pushString(A[2,string])
  83. }
  84. }
  85. if(moneyClk()){
  86. foreach(K,RP:entity=MRP){
  87. if(moneyClkPlayer()==RP){
  88. Que:pushString(MRS[K,string])
  89. Quep:pushEntity(RP)
  90. print("added "+MRS[K,string]+" requested by: "+RP:name())
  91. QueIP:pushNumber(1)
  92. MRP:remove(K)
  93. MRS:remove(K)
  94. }
  95. }
  96. }
  97. #[if(chatClk(owner())){
  98. local A = owner():lastSaid():explode(" ")
  99.  
  100. if (A[1,string]=="!youtube")
  101. {
  102. print("Requesting Link... Please Wait...")
  103. httpRequest("?youtubelink="+A[2,string])
  104. }
  105.  
  106. }]#
  107. if(Que:count()>=1&!SP&!RQ){
  108. RQ=1
  109. httpRequest("http://michaelbelgium.me/ytconverter/convert.php?youtubelink="+Que[1,string])
  110. httpRequest("http://michaelbelgium.me/ytconverter/convert.php?youtubelink="+Que[1,string])
  111. print("Requesting: "+Que[1,string])
  112. CS=Que[1,string]
  113. CSR=Quep[1,entity]
  114. CSIP=QueIP[1,entity]
  115. timer("timeout",10000)
  116. }
  117. if(httpClk()){
  118. RQ=0
  119. local Table=jsonDecode(httpData())
  120. if(!Table["error",number]){
  121. if(Table["duration",number]==0){
  122. print("song request error retrying")
  123. httpRequest("http://michaelbelgium.me/ytconverter/convert.php?youtubelink="+Que[1,string])
  124. }elseif(Table["duration",number]<300&QueIP[1,number]&!Table["duration",number]==0|Table["duration",number]&!QueIP[1,number]){
  125. RTC=0
  126. SP=1
  127. streamStop(1)
  128. soundURLload(1,Table["file",string],0,0,entity())
  129. print(Table["duration",string])
  130. local Text="Now Playing: " +Table["title",string]
  131. setName(Text)
  132. print(Text)
  133. Que:remove(1)
  134. Quep:remove(1)
  135. QueIP:remove(1)
  136. timer("song_over",Table["duration",number]*1000)
  137. }elseif(Table["duration",number]>300){
  138. Que:remove(1)
  139. Quep:remove(1)
  140. QueIP:remove(1)
  141. print("song over 5 mins skipping")
  142. }
  143. }else {
  144. local Text="Song failed to Load"
  145. print(Text)
  146. RTC++
  147. print(RTC)
  148. if(RTC>3){print("song skipped") Que:remove(1) Quep:remove(1) QueIP:remove(1) RTC=0}else{print("retrying")}
  149. }
  150. }
  151. if(clk("song_over")){SP=0 print("song ending....") soundURLPurge()}
  152. if(clk("timeout")){RQ=0 print("fuck")}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement