Ok so for some reason my addon is not loading.
these files don't load, nor does the entire addon? (all the sound files aswell)
I have tried this addon without the sounds and still doesnt work.
I tried going into playsound and it still didnt work.
I have tried adding addon.txt and addon.json and still doesnt work!
[CODE]
overwatch-soundpack/lua/autorun/init.lua
overwatch-soundpack/lua/autorun/cl_init.lua
[/CODE]
init.lua
[CODE]AddCSLuaFile()
if SERVER then
util.AddNetworkString( "voicelines_menu" )
end
include( "cl_init.lua" )
hook.Add( "PlayerSay", "PlayerSayExample", function( ply, text, team )
if ( string.sub( text, 1, 10 ) == "/ow_voicepack" ) then
print( "[Custom Sounds Overwatch] Successfully loaded!" )
net.Start("voicelines_menu")
net.Send( ply )
return ""
end
end )[/CODE]
oh and beware cl_init.lua is HUGE!
[CODE]AddCSLuaFile()
local files, directories = file.Find( "overwatch-sounds/sound/hero/*", "GAME" )
local freaper, dreaper = file.Find( "overwatch-sounds/sound/hero/reaper/*.mp3", "GAME" )
local heroes = {}
for k,v in pairs( directories ) do
table.insert( heroes, v )
end
local reaper = {}
local freaper, dreaper = file.Find( "overwatch-sounds/sound/hero/reaper/*.mp3", "GAME" )
for k,v in pairs( freaper ) do
table.insert( reaper, v )
end
hook.Add( "reaper", "reaperrun", function()
local Scroll = vgui.Create( "DScrollPanel", Frame ) //Create the Scroll panel
Scroll:SetSize( Frame:GetWide(), Frame:GetTall() )
Scroll:SetPos( 0, 0 )
local layout = vgui.Create( "DListLayout", Scroll )
layout:SetSize( Frame:GetWide(), Frame:GetTall() )
layout:SetPos( 0, 0 )
for k,v in pairs( reaper ) do
local ListItem = layout:Add( "DButton" )
ListItem:SetSize( Frame:GetWide(), Frame:GetTall()/5 )
ListItem:SetText( "" )
ListItem.Paint = function( self, w, h )
if ListItem:IsHovered() then
draw.RoundedBox( 0, 0, 0, w, h, Color( 50, 50, 50, 255 ) )
else
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
end
draw.DrawText( v, "DermaLarge", w/2, h/2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
end
ListItem.DoClick = function()
LocalPlayer():EmitSound( "sound/hero/reaper/"..v )
Frame:Close()
Frame:Remove()
end
end
end)
local mercy = {}
local fmercy, dmercy = file.Find( "overwatch-sounds/sound/hero/mercy/*.mp3", "GAME" )
for k,v in pairs( fmercy ) do
table.insert( mercy, v )
end
hook.Add( "mercy", "mercyrun", function()
local Scroll = vgui.Create( "DScrollPanel", Frame ) //Create the Scroll panel
Scroll:SetSize( Frame:GetWide(), Frame:GetTall() )
Scroll:SetPos( 0, 0 )
local layout = vgui.Create( "DListLayout", Scroll )
layout:SetSize( Frame:GetWide(), Frame:GetTall() )
layout:SetPos( 0, 0 )
for k,v in pairs( mercy ) do
local ListItem = layout:Add( "DButton" )
ListItem:SetSize( Frame:GetWide(), Frame:GetTall()/5 )
ListItem:SetText( "" )
ListItem.Paint = function( self, w, h )
if ListItem:IsHovered() then
draw.RoundedBox( 0, 0, 0, w, h, Color( 50, 50, 50, 255 ) )
else
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
end
draw.DrawText( v, "DermaLarge", w/2, h/2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
end
ListItem.DoClick = function()
LocalPlayer():EmitSound( "sound/hero/mercy/"..v )
Frame:Close()
Frame:Remove()
end
end
end)
local reinheart = {}
local freinheart, dreinheart = file.Find( "overwatch-sounds/sound/hero/reinhardt/*.mp3", "GAME" )
for k,v in pairs( freinheart ) do
table.insert( reinheart, v )
end
hook.Add( "reinhardt", "reinhardtrun", function()
local Scroll = vgui.Create( "DScrollPanel", Frame ) //Create the Scroll panel
Scroll:SetSize( Frame:GetWide(), Frame:GetTall() )
Scroll:SetPos( 0, 0 )
local layout = vgui.Create( "DListLayout", Scroll )
layout:SetSize( Frame:GetWide(), Frame:GetTall() )
layout:SetPos( 0, 0 )
for k,v in pairs( reinhardt ) do
local ListItem = layout:Add( "DButton" )
ListItem:SetSize( Frame:GetWide(), Frame:GetTall()/5 )
ListItem:SetText( "" )
ListItem.Paint = function( self, w, h )
if ListItem:IsHovered() then
draw.RoundedBox( 0, 0, 0, w, h, Color( 50, 50, 50, 255 ) )
else
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
end
draw.DrawText( v, "DermaLarge", w/2, h/2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
end
ListItem.DoClick = function()
LocalPlayer():EmitSound( "sound/hero/reinhardt/"..v )
Frame:Close()
Frame:Remove()
end
end
end)
local junkrat = {}
local fjunkrat, djunkrat = file.Find( "overwatch-sounds/sound/hero/junkrat/*.mp3", "GAME" )
for k,v in pairs( fjunkrat ) do
table.insert( junkrat, v )
end
hook.Add( "junkrat", "junkratrun", function()
local Scroll = vgui.Create( "DScrollPanel", Frame ) //Create the Scroll panel
Scroll:SetSize( Frame:GetWide(), Frame:GetTall() )
Scroll:SetPos( 0, 0 )
local layout = vgui.Create( "DListLayout", Scroll )
layout:SetSize( Frame:GetWide(), Frame:GetTall() )
layout:SetPos( 0, 0 )
for k,v in pairs( junkrat ) do
local ListItem = layout:Add( "DButton" )
ListItem:SetSize( Frame:GetWide(), Frame:GetTall()/5 )
ListItem:SetText( "" )
ListItem.Paint = function( self, w, h )
if ListItem:IsHovered() then
draw.RoundedBox( 0, 0, 0, w, h, Color( 50, 50, 50, 255 ) )
else
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
end
draw.DrawText( v, "DermaLarge", w/2, h/2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
end
ListItem.DoClick = function()
LocalPlayer():EmitSound( "sound/hero/junkrat/"..v )
Frame:Close()
Frame:Remove()
end
end
end)
local symmetra = {}
local fsymmetra, dsymmetra = file.Find( "overwatch-sounds/sound/hero/symmetra/*.mp3", "GAME" )
for k,v in pairs( fsymmetra ) do
table.insert( symmetra, v )
end
hook.Add( "symmetra", "symetrarun", function()
local Scroll = vgui.Create( "DScrollPanel", Frame ) //Create the Scroll panel
Scroll:SetSize( Frame:GetWide(), Frame:GetTall() )
Scroll:SetPos( 0, 0 )
local layout = vgui.Create( "DListLayout", Scroll )
layout:SetSize( Frame:GetWide(), Frame:GetTall() )
layout:SetPos( 0, 0 )
for k,v in pairs( symmetra ) do
local ListItem = layout:Add( "DButton" )
ListItem:SetSize( Frame:GetWide(), Frame:GetTall()/5 )
ListItem:SetText( "" )
ListItem.Paint = function( self, w, h )
if ListItem:IsHovered() then
draw.RoundedBox( 0, 0, 0, w, h, Color( 50, 50, 50, 255 ) )
else
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
end
draw.DrawText( v, "DermaLarge", w/2, h/2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
end
ListItem.DoClick = function()
LocalPlayer():EmitSound( "sound/hero/symmetra/"..v )
Frame:Close()
Frame:Remove()
end
end
end)
local genji = {}
local fgenji, dgenji = file.Find( "overwatch-sounds/sound/hero/genji/*.mp3", "GAME" )
for k,v in pairs( fgenji ) do
table.insert( genji, v )
end
hook.Add( "genji", "genjirun", function()
local Scroll = vgui.Create( "DScrollPanel", Frame ) //Create the Scroll panel
Scroll:SetSize( Frame:GetWide(), Frame:GetTall() )
Scroll:SetPos( 0, 0 )
local layout = vgui.Create( "DListLayout", Scroll )
layout:SetSize( Frame:GetWide(), Frame:GetTall() )
layout:SetPos( 0, 0 )
for k,v in pairs( genji ) do
local ListItem = layout:Add( "DButton" )
ListItem:SetSize( Frame:GetWide(), Frame:GetTall()/5 )
ListItem:SetText( "" )
ListItem.Paint = function( self, w, h )
if ListItem:IsHovered() then
draw.RoundedBox( 0, 0, 0, w, h, Color( 50, 50, 50, 255 ) )
else
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
end
draw.DrawText( v, "DermaLarge", w/2, h/2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
end
ListItem.DoClick = function()
LocalPlayer():EmitSound( "sound/hero/genji/"..v )
Frame:Close()
Frame:Remove()
end
end
end)
local hanzo = {}
local fhanzo, dhanzo = file.Find( "overwatch-sounds/sound/hero/hanzo/*.mp3", "GAME" )
for k,
Your file names are not unique and most likely are being overridden by some other shitty addon with same shitty non unique file names.
[editline]9th December 2016[/editline]
Also file.Find doesn't work like that, you don't need to include the folder name of your addon. Read the wiki page for the function.
[editline]9th December 2016[/editline]
And you do not really need include() and AddCSLuaFile() for files in [b]autorun/[/b], they are being [b]automatically ran[/b] for you.
I made a new file, called it youcantoverrideme, then I did this:
[CODE]youcantoverrideme/
youcantoverrideme/lua
youcantoverrideme/lua/autorun
youcantoverrideme/lua/autorun/init.lua
init.lua:
if CLIENT then
for i = 1, 8 do
print( "ay this works!" )
end
end[/CODE]
Sorry, you need to Log In to post a reply to this thread.