• Lua Error ( Need Help )
    2 replies, posted
Hey, i did wanted to create an Admin Menu for my servers and my problem is that my config file wont include. There is the code: ( sh_kwadmin_config.lua ) KW_Adminpanel = {} KW_Adminpanel.Config = {} -- CONFIG FILE print("Loading Config File") -- Kto ma dostep do opcji zmieniania stylu gui. KW_Adminpanel.Config.RootTeams = { "superadmin", "menadzer" } print("Loaded Config Fille succesfully") concommand.Add("testhelp", function() PrintTable(KW_Adminpanel.Config.RootTeams) end) ( cl_kwadmin.lua ) include("kwadmin/sh_kwadmin_config.lua") function adminmenuopen() local ply = LocalPlayer() if IsValid(adminmenu) then adminmenu:Remove() ply:ChatPrint("Twoj Panel Admina juz jest otwarty") return end local adminmenu = vgui.Create("DFrame") adminmenu:SetSize( 650, 550 ) adminmenu:Center() adminmenu:MakePopup() adminmenu:SetTitle("Panel Administratora") adminmenu:SetDraggable( true ) adminmenu:ShowCloseButton( false ) adminmenu.Paint = function() draw.RoundedBox(0,0,0,ScrH(),ScrW(),Color(55,55,55)) end local zamknijprzycisk = vgui.Create("DButton", adminmenu) zamknijprzycisk:SetSize( 25, 25 ) zamknijprzycisk:SetPos( 614, 10 ) zamknijprzycisk:SetText("X") zamknijprzycisk.DoClick = function() if IsValid(adminmenu) then adminmenu:Remove() ply:ChatPrint("Panel Admina zostal pomyslnie zamkniety!") else ply:ChatPrint("Panel Admina zostal juz zamkniety") end end zamknijprzycisk.Paint = function() draw.RoundedBox(0,0,0,ScrH(),ScrW(),Color(255,255,255)) end if table.HasValue(KW_Adminpanel.Config.RootTeams, ply:GetUserGroup()) then local themeselector = vgui.Create("DButton", adminmenu) themeselector:SetSize( 100, 25 ) themeselector:SetPos( 500, 10 ) themeselector:SetText("Wybor Stylu") themeselector.DoClick = function() if IsValid(adminmenu) then adminmenu:Remove() end kwthemeopen() end themeselector.Paint = function() draw.RoundedBox(0,0,0,ScrH(),ScrW(),Color(255,255,255)) end end end usermessage.Hook("Apannel_Open", adminmenuopen) concommand.Add("openadmin", adminmenuopen) Why doesn't it work?
Please make more descriptive titles next time. Can you tell us what is working? Anything?
Well both of files are working but when i try to include the config file on the cl_kwadmin file this error appears : Couldn't include file 'kwadmin\sh_kwadmin_config.lua' (File not found) (@addons/kwadmin/lua/kwadmin/cl_kwadmin.lua (line 1)) Couldn't include file 'kwadmin\sh_kwadmin_config.lua' (File not found) (@addons/kwadmin/lua/kwadmin/cl_kwadmin.lua (line 1)) And when i type !paneladmina ( adminpanel ) this does appear: [ERROR] addons/kwadmin/lua/kwadmin/cl_kwadmin.lua:40: attempt to index global 'KW_Adminpanel' (a nil value)   1. Function - addons/kwadmin/lua/kwadmin/cl_kwadmin.lua:40    2. unknown - lua/includes/modules/usermessage.lua:87 what means that it does not knows what KW_Adminpanel is because it won't include that's why it doesn't work
Sorry, you need to Log In to post a reply to this thread.