Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Bmans Youtube Player
- @trigger
- @persist [Auth Que MRP MRS Quep QueIP]:array SP RQ RTC CS:string CSR:entity
- if(first()){
- runOnTick(1)
- runOnChat(1)
- runOnHTTP(1)
- streamDisable3D(1)
- Volume = 1.0
- holoCreate(1)
- holoParent(1,entity())
- holoModel(1, "models/props_lab/citizenradio.mdl")
- holoAnim(1, "act_gmod_taunt_dance")
- timer("dance", holoAnimLength(1) * 945)
- Auth:pushEntity(owner())
- }
- interval(300)
- if(first()){
- runOnChat(1)
- runOnHTTP(1)
- #runOnLast(1)
- E=entity()
- O=owner()
- }
- if(chatClk()){
- LS=lastSaid()
- LSP=lastSpoke()
- if(LS:sub(1,5)=="!add "){
- FP=findPlayerByName(LS:sub(6, LS:length()))
- hint("Allowed user: "+FP:name(),1000)
- Auth:pushEntity(FP)
- print(Auth:count())
- }
- if(LS:sub(1,8)=="!remove "){
- FP=findPlayerByName(LS:sub(9, LS:length()))
- hint("removed user: "+FP:name(),1000)
- foreach(K,RP:entity=Auth){
- if(RP==Auth[K,entity]){Auth:remove(K)}
- }
- print(Auth:count())
- }
- A=LS:explode(" ")
- if (A[1,string]=="!youtube")
- {
- foreach(K,Au:entity=Auth){
- if(Au==LSP){
- LSP:sendMessageColor("link added to Que, your link has "+Que:count()+" song/s in front of it!")
- #httpRequest("http://michaelbelgium.me/ytconverter/convert.php?youtubelink="+A[2,string])
- print("user: "+LSP:name()+" requesting "+A[2,string])
- Que:pushString(A[2,string])
- QueIP:pushNumber(0)
- Quep:pushEntity(LSP)
- break
- }
- }
- }
- if(LS:sub(1,7) == "!volume"){
- hideChat(1)
- owner():sendMessage("Changed current station's volume to "+lastSaid():sub(9):toNumber())
- soundURLvolume(1,lastSaid():sub(9):toNumber()/100)
- }
- if(LS=="!skip"&LSP==owner()){
- SP=0
- stoptimer("song_over")
- timer("song_over",100)
- print("skipping song requested by: "+CSR:name())
- foreach(K,Ss:string=Que){
- if(Ss==CS){
- Que:remove(K)
- Quep:remove(K)
- print("removed additional entry of same song!")
- }
- }
- }
- if (A[1,string]=="!yt"){
- moneyRequest(LSP,2000,"payment for song request")
- MRP:pushEntity(LSP)
- MRS:pushString(A[2,string])
- }
- }
- if(moneyClk()){
- foreach(K,RP:entity=MRP){
- if(moneyClkPlayer()==RP){
- Que:pushString(MRS[K,string])
- Quep:pushEntity(RP)
- print("added "+MRS[K,string]+" requested by: "+RP:name())
- QueIP:pushNumber(1)
- MRP:remove(K)
- MRS:remove(K)
- }
- }
- }
- #[if(chatClk(owner())){
- local A = owner():lastSaid():explode(" ")
- if (A[1,string]=="!youtube")
- {
- print("Requesting Link... Please Wait...")
- httpRequest("?youtubelink="+A[2,string])
- }
- }]#
- if(Que:count()>=1&!SP&!RQ){
- RQ=1
- httpRequest("http://michaelbelgium.me/ytconverter/convert.php?youtubelink="+Que[1,string])
- httpRequest("http://michaelbelgium.me/ytconverter/convert.php?youtubelink="+Que[1,string])
- print("Requesting: "+Que[1,string])
- CS=Que[1,string]
- CSR=Quep[1,entity]
- CSIP=QueIP[1,entity]
- timer("timeout",10000)
- }
- if(httpClk()){
- RQ=0
- local Table=jsonDecode(httpData())
- if(!Table["error",number]){
- if(Table["duration",number]==0){
- print("song request error retrying")
- httpRequest("http://michaelbelgium.me/ytconverter/convert.php?youtubelink="+Que[1,string])
- }elseif(Table["duration",number]<300&QueIP[1,number]&!Table["duration",number]==0|Table["duration",number]&!QueIP[1,number]){
- RTC=0
- SP=1
- streamStop(1)
- soundURLload(1,Table["file",string],0,0,entity())
- print(Table["duration",string])
- local Text="Now Playing: " +Table["title",string]
- setName(Text)
- print(Text)
- Que:remove(1)
- Quep:remove(1)
- QueIP:remove(1)
- timer("song_over",Table["duration",number]*1000)
- }elseif(Table["duration",number]>300){
- Que:remove(1)
- Quep:remove(1)
- QueIP:remove(1)
- print("song over 5 mins skipping")
- }
- }else {
- local Text="Song failed to Load"
- print(Text)
- RTC++
- print(RTC)
- if(RTC>3){print("song skipped") Que:remove(1) Quep:remove(1) QueIP:remove(1) RTC=0}else{print("retrying")}
- }
- }
- if(clk("song_over")){SP=0 print("song ending....") soundURLPurge()}
- if(clk("timeout")){RQ=0 print("fuck")}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement