I'm stumped.
I've been trying to incorporate Aarons online streaming radio derma into a usable Entity.
I get this Error when used:
[code] includes/extensions/table.lua:165: bad argument #1 to 'pairs' (table expected, got nil)[/code]
The Radio's Files:
cl_init.lua:
[lua]
include("shared.lua")
function ENT:Draw()
self:DrawEntityOutline(0.0)
self:DrawModel()
end
local firstruncheck = 0
local pan
function radio()
if firstruncheck == 0 then
panel = vgui.Create( "DFrame" )
panel:SetPos( 100, 60)
panel:SetSize(800, 600)
panel:SetTitle( "Radio" )
panel:SetVisible( true )
panel:SetDraggable( true )
panel:ShowCloseButton( false )
panel:SetSizable(true)
panel:MakePopup()
pan = panel
local w = panel:GetWide()
local h = panel:GetTall()
local closebutton = vgui.Create( "DImageButton", panel )
closebutton:SetPos( 780, 5 )
closebutton:SetImage( "silkicons/exclamation.vtf" )
closebutton:SizeToContents()
closebutton.DoClick = function()
mouseExitPosX, mouseExitPosY = gui.MousePos()
radiopage:StopAnimate()
if panel:IsVisible() then
panel:SetVisible(false)
end
gui.EnableScreenClicker(false)
end
local PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( panel )
PropertySheet:SetPos( 5, 30 )
PropertySheet:SetSize( w-10, h-35 )
--------------------------Begin Radio Tab----------------------------------
radiourl = [[<html>
<body><font size="1" face="Verdana"><center>
<b>Welcome</b><br>
This Is Aarons GarrysMod Radio<br>
You can load your custom url's by pressing the "load custom url" button below <br>
Make sure you dont put the http:// or www. tho or else it wont work<br>
Or you can load one of our fine selection of stations above :D <br>
<font size="1" face="Verdana"></center>
</body>
</html>
]]
radiolastsaidsong = 0
timer.Create("saysongtimer", 1, 0, function()
radiolastsaidsong = radiolastsaidsong - 1
if
radiolastsaidsong < 0
then radiolastsaidsong = 0
end
end )
local RADIO = vgui.Create( "DPanel", PropertySheet )
RADIO:SetSize( w-20, h-45 )
RADIO.Paint = function()
surface.SetDrawColor( 0, 0, 0, 0 )
surface.DrawRect( 0, 0, RADIO:GetWide(), RADIO:GetTall() )
end
radiolist = vgui.Create("DListView")
radiolist:SetParent(RADIO)
radiolist:SetPos(1, 1)
radiolist:SetSize(775, 430)
radiolist:SetMultiSelect(false)
radiolist:SetSortable(true)
local lstRadioTitle = radiolist:AddColumn("Title")
local lstRadioURL = radiolist:AddColumn("URL")
local lstRadioGenre = radiolist:AddColumn("Genre")
local lstRadioType = radiolist:AddColumn("Type")
radiolist:SortByColumn( 1 )
lstRadioTitle:SetWide( 100 )
lstRadioURL:SetWide( 300 )
lstRadioGenre:SetWide( 15 )
lstRadioType:SetWide( 1 )
radiopage = vgui.Create( "HTML" , RADIO);
radiopage:SetPos(0,445);
radiopage:SetSize(775,255);
radiopage:SetVisible(true);
radiopage:SetHTML( radiourl );
radiopage:Refresh(true);
radiopage:StartAnimate(100)
radiolist.OnRowSelected = function()
radioselect = DermaMenu()
radioselect:AddOption("Load This For Me Please", function()
panel:SetTitle( "Radio".." - Currently Listining To: Title: "..radiosongTitle..
" URL: "..radiosongURL.." Genre: "..radiosongGenre )
radiourl = [[<center>
<OBJECT ID="MediaPlayer" WIDTH="750" HEIGHT="44" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="http://]]..radiosongURL..[[">
<PARAM name="autostart" VALUE="true">
<PARAM name="ShowControls" VALUE="true">
<param name="ShowStatusBar" value="false">
<PARAM name="ShowDisplay" VALUE="false">
</OBJECT>
</center>]]
radiopage:SetHTML( radiourl );
myradiotype = "aaron"
print("\n\nCurrently Selected Song: \nTitle: "..radiosongTitle.."\nURL: "..radiosongURL.."\nGenre: "..radiosongGenre.."\nType: "..radiosongType.."\n\n")
if radiolastsaidsong <= 0 then
radiolastsaidsong = 30
LocalPlayer():ConCommand("say \"/me Is Currently Listening To (Aarons Radio) "..radiosongTitle.."\"")
else
LocalPlayer():ChatPrint("Please Wait "..radiolastsaidsong.." Seconds Before Announcing Your Song")
end
end )
radioselect:AddOption("Load This For Me Please - Dont Announce Tho", function()
panel:SetTitle( "Radio".." - Currently Listining To: Title: "..radiosongTitle..
" URL: "..radiosongURL.." Genre: "..radiosongGenre )
radiourl = [[<center>
<OBJECT ID="MediaPlayer" WIDTH="750" HEIGHT="44" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="http://]]..radiosongURL..[[">
<PARAM name="autostart" VALUE="true">
<PARAM name="ShowControls" VALUE="true">
<param name="ShowStatusBar" value="false">
<PARAM name="ShowDisplay" VALUE="false">
</OBJECT>
</center>]]
radiopage:SetHTML( radiourl );
myradiotype = "aaron"
print("\n\nCurrently Selected Song: \nTitle: "..radiosongTitle.."\nURL: "..radiosongURL.."\nGenre: "..radiosongGenre.."\nType: "..radiosongType.."\n\n")
end )
radioselect:Open()
radiosongTitle = radiolist:GetLine(radiolist:GetSelectedLine()):GetValue(1)
radiosongURL = radiolist:GetLine(radiolist:GetSelectedLine()):GetValue(2)
radiosongGenre = radiolist:GetLine(radiolist:GetSelectedLine()):GetValue(3)
radiosongType = radiolist:GetLine(radiolist:GetSelectedLine()):GetValue(4)
end
radiostop = vgui.Create( "DButton", RADIO )
radiostop:SetParent( RADIO )
radiostop:SetSize(RADIO:GetWide()-500, 15)
radiostop:SetPos( 490,432 )
radiostop:SetText( "Refresh The Radio" )
radiostop.DoClick = function( button )
reloadplylist()
reloadAaronsRadio()
firstruncheck = 1
end
radiostop = vgui.Create( "DButton", RADIO )
radiostop:SetParent( RADIO )
radiostop:SetSize(RADIO:GetWide()-532, 15)
radiostop:SetPos( 248,432 )
radiostop:SetText( "Turn Off The Radio" )
radiostop.DoClick = function( button )
radiourl = [[<center>Radio Stopped</center>]]
radiopage:SetHTML( radiourl );
panel:SetTitle( "Radio" )
end
radioload = vgui.Create( "DButton", RADIO )
radioload:SetParent( RADIO )
radioload:SetSize(RADIO:GetWide()-532, 15)
radioload:SetPos( 1,432 )
radioload:SetText( "Load Custom URL" )
radioload.DoClick = function( button )
local customradio = vgui.Create( "DFrame" )
customradio:SetPos( 250,250 )
customradio:SetSize( 500, 50 )
customradio:SetTitle( "UR
You should add prints every so often to narrow down what line that error came from.
Your problem is probably line 213 in cl_init.lua:
[lua]for _, Line in pairs(string.Explode("\n", SiteArgs)) do[/lua]
I don't see SiteArgs defined anywhere.
Sorry, you need to Log In to post a reply to this thread.