• I'm Not Really Sure What To Do At All Really
    8 replies, posted
Soooo, I was looking through the workshop for gmod13 and saw an youtube video audio player and thought it was cool, however. When I uploaded it to my server and restarted it after upload nothing it wouldn't appear in under the utilites tab. Here's the workshop addon URL: [HTML]http://steamcommunity.com/sharedfiles/filedetails/?id=104755204[/HTML] Original Code: [CODE]//Addon created by Overlord Spamalot if SERVER then AddCSLuaFile("gtube.lua") util.AddNetworkString("GTubePlay") util.AddNetworkString("GTubeStop") net.Receive("GTubePlay",function(len,ply) if(!ply:IsAdmin())then return end net.Start("GTubePlay") net.WriteString(net.ReadString()) net.Broadcast() end) net.Receive("GTubeStop",function(len,ply) if(!ply:IsAdmin())then return end net.Start("GTubeStop") net.Broadcast() end) print("Server Loaded G-Tube Player!") else surface.CreateFont("GTubeFont",{ font = "UiBold", size = ScreenScale(10), weight = 300, antialias = true, shadow = false}) local Enabled=CreateClientConVar("gtube_enabled",1,true,false) local URL=CreateClientConVar("gtube_url","",false,false) local Playing=false local StartTime=0 local SongLength=0 local SongName="" local function GtubeParseYoutube(str) if string.find(str,"youtube")!=nil then str=string.match(str,"[?&]v=([^&]*)") end return str end local function secToTime(sec) local m=math.floor(sec/60) local s=tostring(math.floor(sec-m*60)) if string.len(s)==1 then s="0"..s end return m..":"..s end local function GtubeMsg(str) chat.AddText(Color(0,255,255),"[G-Tube Player] ",Color(255,255,255),str) end local function GtubeErr(str) chat.AddText(Color(255,0,0),"[G-Tube Player]",Color(200,0,0)," ERROR: "..str) end local function GtubePanel(Panel) Panel:ClearControls() Panel:AddControl("CheckBox",{Label = "Enabled",Command = "gtube_enabled"}) if(LocalPlayer():IsAdmin())then Panel:AddControl("Textbox",{Label = "Youtube URL: ",Command = "gtube_url"}) Panel:AddControl("Button",{Label = "Play",Command = "gtube_play"}) Panel:AddControl("Button",{Label = "Stop",Command = "gtube_stop"}) end end hook.Add("PopulateToolMenu","G-TubePAMenu",function() spawnmenu.AddToolMenuOption("Utilities","G-Tube","G-Tube Player","#G-Tube Player","","",GtubePanel) end) html = vgui.Create("HTML") html:SetEnabled(true) html:SetPos(0,0) html:SetSize(0,0) html:SetPaintedManually(true) html:SetMouseInputEnabled(false) html:OpenURL("http://www.youtube.com/v/") local function PlaySong(URI) if(Enabled:GetBool())then http.Fetch("http://gdata.youtube.com/feeds/api/videos/"..URI,function(data,code,headers) SongName=string.match(data,"<title type='text'>([^<]+)</title>") SongLength=tonumber(string.match(data,"<yt:duration seconds='([^<]+)'/>")) if SongName==nil or SongLength==nil then SongName="" SongLength=0 GtubeErr("Could not load URI: "..URI) else GtubeMsg("Playing: "..SongName.." ("..URI..")") Playing=true StartTime=RealTime() html:OpenURL("http://youtube.googleapis.com/v/"..URI.."&autoplay=1&enablejsapi=1") end end,nil) end end local function StopSong() if(Playing)then html:OpenURL("http://www.youtube.com/v/") Playing=false GtubeMsg("Audio stopped.") end end local function GtubeHUD() if Playing and !Enabled:GetBool() then StopSong() end if RealTime()-StartTime >= SongLength+5 and Playing then StopSong() end if Playing then local w=string.len(SongName)*12 draw.RoundedBox(0,ScrW()/2-w/2,10,w,20,Color(30,190,190,255)) draw.SimpleText(SongName,"GTubeFont",ScrW() / 2,21,Color(0,0,0,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) draw.RoundedBox(0,ScrW()/2-110/2,30,110,20,Color(200,200,200,150)) draw.SimpleText(secToTime(RealTime()-StartTime).."/"..secToTime(SongLength),"GTubeFont",ScrW() / 2,41,Color(0,0,0,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) surface.SetDrawColor(0,0,0,255) surface.DrawLine(ScrW()/2-w/2,10,ScrW()/2+w/2,10) surface.DrawLine(ScrW()/2+w/2,10,ScrW()/2+w/2,30) surface.DrawLine(ScrW()/2-w/2,10,ScrW()/2-w/2,30) surface.DrawLine(ScrW()/2-w/2,30,ScrW()/2-45,30) surface.DrawLine(ScrW()/2-45,30,ScrW()/2+w/2,30) surface.DrawLine(ScrW()/2-55,30,ScrW()/2-55,50) surface.DrawLine(ScrW()/2+55,30,ScrW()/2+55,50) surface.DrawLine(ScrW()/2-55,50,ScrW()/2+55,50) end end hook.Add("HUDPaint","GtubePAHUD",GtubeHUD) concommand.Add("gtube_play",function(ply,c,args) net.Start("GTubePlay") net.WriteString(GtubeParseYoutube(URL:GetString())) net.SendToServer() end) concommand.Add("gtube_stop",function(ply,c,args) net.Start("GTubeStop") net.SendToServer() end) net.Receive("GTubePlay",function(len) PlaySong(net.ReadString()) end) net.Receive("GTubeStop",function(len) StopSong() end) print("Client Loaded G-Tube Player!") end[/CODE] [editline]3rd November 2012[/editline] Anything obvious here?
Are you getting any errors? Also, from that title I assumed you would be another of Tyler's alts :v:
[QUOTE=.\\Shadow};38307438]Are you getting any errors? Also, from that title I assumed you would be another of Tyler's alts :v:[/QUOTE] Nope, no errors. And who is this tyler?
[QUOTE=nathsters;38309045]Nope, no errors. And who is this tyler?[/QUOTE] It's Because You Were Typing Like This. On topic though, did you test the addon in singleplayer before you tried putting it on the server? If you didn't make any changes to the code it may just be broken with the latest update of Garrysmod.
[QUOTE=Zyler;38311738]It's Because You Were Typing Like This. On topic though, did you test the addon in singleplayer before you tried putting it on the server? If you didn't make any changes to the code it may just be broken with the latest update of Garrysmod.[/QUOTE] Yep. Worked on single player.
[QUOTE=nathsters;38322625]Yep. Worked on single player.[/QUOTE] [url]http://199.191.56.142/gtube.zip[/url] It's in legacy format, I have nothing to test this on at the moment. (Drag and drop in addons.)
nope still nothing. I tried garry's way of subscribing a server to a workshop addon. that didn't work, anyways the ip to my server is [URL="steam://connect/50.31.22.36:27015"]steam launch[/URL] if you'd like to get on there and test, ftp supported. Sound interested?
[QUOTE=nathsters;38324919]nope still nothing. I tried garry's way of subscribing a server to a workshop addon. that didn't work, anyways the ip to my server is [URL="steam://connect/50.31.22.36:27015"]steam launch[/URL] if you'd like to get on there and test, ftp supported. Sound interested?[/QUOTE] And you're server is updated to the latest version of gmod? You're running a dedicated server and you put rokrox's folder in "orangebox/garrysmod/addons" right? If you are and it's still not working then maybe you should post an error report in the "Help and Support" section.
[QUOTE=nathsters;38324919]nope still nothing. I tried garry's way of subscribing a server to a workshop addon. that didn't work, anyways the ip to my server is [URL="steam://connect/50.31.22.36:27015"]steam launch[/URL] if you'd like to get on there and test, ftp supported. Sound interested?[/QUOTE] I've just tested the zip I posted on my dev, below are some screenshots, other than the fact that the mod plays the video at max volume and there's no slider for controlling it, it works fine. [url]http://i49.tinypic.com/5mzmu9.png[/url] Please make sure you're extracting the zip in the right place.
Sorry, you need to Log In to post a reply to this thread.