The warn system i use, has a menu but it doesn't work I need help
2 replies, posted
Code
include("fbiwarn_config.lua")
if CLIENT thenfunction WarnMenu()local f = vgui.Create( "DFrame" )
f:SetSize(ScrW()*0.277,ScrH()*0.138)
f:SetTitle("Birbs Warn Menu")
f:SetVisible(true)
f:SetDraggable(true)
f:ShowCloseButton(true)
f:Center()
f:MakePopup()
local WarnList = vgui.Create( "DListView", f )
WarnList:Dock( FILL )
WarnList:SetMultiSelect( false )
WarnList:AddColumn( "Player" )
WarnList:AddColumn( "Warns" )
for k,v inpairs(player.GetAll()) do
WarnList:AddLine(v:Nick(), v:GetWarns())
end
WarnList.OnRowSelected = function( lst, index, pnl )print( "Selected " .. pnl:GetColumnText( 1 ) .. " ( " .. pnl:GetColumnText( 2 ) .. " ) at index " .. index )
local playerName = pnl:GetColumnText(1)
endendfunction WarnChat(ply, text)
hook.Add( "OnPlayerChat", "NocoolWarns", WarnChat)
if (string.lower(text) == "!warns" ) thenif CLIENT andtable.HasValue(AccessToMenu, ply:GetNWString("usergroup")) then WarnMenu()
endend )
Error:
unexpected symbol near ) Line:34
Error:
[DLib] hook.Add - function is not a function! nil
stack traceback:
lua/dlib/modules/hook.lua:354: in function 'Add'
addons/bp-warn-system-ubuntu/lua/autorun/cl_warnmenu.lua:36: in main chunk
you need to look at your endings, youve ended WarnChat twice and not ended WarnMenu, you can see this in the error message "cl_warnmenu.lua:36:" which is "end" . it helps to indent and separate lines properly to see this, something like this i imagine should work (if it doesnt then id suggest cutting down the code to only open the dframe with the just the chat command in the if syntax and slowly adding stuff on to that) :
include("fbiwarn_config.lua")
if CLIENT then
function WarnMenu()
local f = vgui.Create( "DFrame" )
f:SetSize(ScrW()*0.277,ScrH()*0.138)
f:SetTitle("Birbs Warn Menu")
f:SetVisible(true)
f:SetDraggable(true)
f:ShowCloseButton(true)
f:Center()
f:MakePopup()
local WarnList = vgui.Create( "DListView", f )
WarnList:Dock( FILL )
WarnList:SetMultiSelect( false )
WarnList:AddColumn( "Player" )
WarnList:AddColumn( "Warns" )
for k,v in pairs(player.GetAll()) do
WarnList:AddLine(v:Nick(), v:GetWarns())
end
WarnList.OnRowSelected = function( lst, index, pnl )
print( "Selected " .. pnl:GetColumnText( 1 ) .. " ( " .. pnl:GetColumnText( 2 ) .. " ) at index " .. index )
local playerName = pnl:GetColumnText(1)
end
end
function WarnChat(ply, text)
if ( string.lower(text) == "!warns" and table.HasValue(AccessToMenu, ply:GetNWString("usergroup")) ) then
WarnMenu()
end
end
hook.Add( "OnPlayerChat", "NocoolWarns", WarnChat)
end
Sorry, you need to Log In to post a reply to this thread.