So I have a custom f4 menu. And I've tried to add a thing. But I get spammed with this error
[CODE]ERROR] lua/vgui/dlabel.lua:68: attempt to index local 'col' (a number value)
1. ApplySchemeSettings - lua/vgui/dlabel.lua:68
2. PerformLayout - lua/vgui/dlabel.lua:74
3. unknown - lua/vgui/dbutton.lua:125[/CODE]
And this is the code
[CODE]local colors = {
head = Color(13, 81, 22, 255),
back = Color(164, 18, 18, 180),
text = Color(255, 255, 255, 255),
btn = Color(52, 73, 94, 255),
btn_hover = Color(44, 62, 80, 255),
accept = Color(46, 204, 113, 255),
accept_hover = Color(39, 174, 96, 255),
cancel = Color(231, 76, 60, 255),
cancel_hover = Color(192, 57, 43, 255),
bar = Color(189, 195, 199, 255),
barupdown = Color(127, 140, 141, 255),
transfer = Color(230, 126, 34, 255),
transfer_hover = Color(211, 84, 0, 255),
transfer_disabled = Color(230, 126, 34, 150),
accept_disabled = Color(46, 204, 113, 150),
cancel_disabled = Color(231, 76, 60, 150),
}
local activeDesc = "";
local activeWeapons = {};
function CreateCommandPanel(frame)
local panel = vgui.Create("DPanel", frame);
panel:SetSize(frame:GetWide() - 330, frame:GetTall() - 120);
panel:SetPos(320, 110);
local license = vgui.Create("DButton", panel);
license:SetText("Give License to the player you are looking at");
license:SetColor(255, 255, 255, 255)
license:SetSize(850, 50);
license:SetPos(0, 0);
license.Paint = function() draw.RoundedBox(0, 0, 0, license:GetWide(), license:GetTall(), colors.btn) end
license.DoClick = function()
RunConsoleCommand("say", "/givelicense")
end
local wanted = vgui.Create("DButton", panel);
wanted:SetText("Make someone wanted");
wanted:SetColor(255, 255, 255, 255)
wanted:SetSize(850, 50);
wanted:SetPos(0, 55);
wanted.Paint = function() draw.RoundedBox(0, 0, 0, wanted:GetWide(), wanted:GetTall(), colors.btn) end
wanted.DoClick = function()
local menuq = DermaMenu()
for _,ply in pairs(player.GetAll()) do
if not ply:GetNWBool("wanted") and ply ~= LocalPlayer() then
menuq:AddOption(ply:Nick(), function() Derma_StringRequest("Wanted reason","What's the reason for wanting this player?","",function(txt) LocalPlayer():ConCommand("say /wanted " .. tostring(ply:UserID() .. " " .. txt)) end, function(txt) end) end)
end
end
if #menuq.Panels == 0 then
menuq:AddOption("Noone available", function() end)
menuq:Open()
end
end
local unwanted = vgui.Create("DButton", panel);
unwanted:SetText("Make someone unwanted");
unwanted:SetColor(255, 255, 255, 255)
unwanted:SetSize(850, 50);
unwanted:SetPos(0, 110);
unwanted.Paint = function() draw.RoundedBox(0, 0, 0, wanted:GetWide(), wanted:GetTall(), colors.btn) end
unwanted.DoClick = function()
local menut = DermaMenu()
for _,ply in pairs(player.GetAll()) do
if not ply:GetNWBool("unwanted") and ply ~= LocalPlayer() then
menut:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("say /unwanted " .. tostring(ply:UserID())) end)
end
end
if #menut.Panels == 0 then
menut:AddOption("Noone available", function() end)
end
end
local warrant = vgui.Create("DButton", panel);
warrant:SetText("Request a warrant");
warrant:SetColor(255, 255, 255, 255)
warrant:SetSize(850, 50);
warrant:SetPos(0, 165);
warrant.Paint = function() draw.RoundedBox(0, 0, 0, warrant:GetWide(), warrant:GetTall(), colors.btn) end
warrant.DoClick = function()
local menun = DermaMenu()
for k, ply in pairs(player.GetAll()) do
if not ply:GetNWBool("warrant") and ply ~= LocalPlayer() then
menun:AddOption(ply:Nick(), function() Derma_StringRequest("Warrant reason","What's the reason for requesting a warrant on this player","",function(txt) LocalPlayer():ConCommand("say /warrant " .. tostring(ply:UserID() .. " " .. txt)) end, function(txt) end) end)
end
end
if #menun.Panels == 0 then
menun:AddOption("Noone available", function() end)
end
menun:Open()
end
local money = vgui.Create("DButton", panel);
money:SetText("Drop money");
money:SetColor(255, 255, 255, 255)
money:SetSize(850, 50);
money:SetPos(0, 220);
money.Paint = function() draw.RoundedBox(0, 0, 0, money:GetWide(), money:GetTall(), colors.btn) end
money.DoClick = function()
local menus = DermaMenu()
Derma_StringRequest("Amount","How much money do you want to drop","",function(txt) LocalPlayer():ConCommand("say /dropmoney " .. " " .. txt)) end function(txt) end)
end
return panel;
end[/CODE]
What is causing the error?
And I'm 99.99% that it is this script that is causing the conflict.
[B][I]Thanks in advance[/I][/B]
DButton:SetColor takes a [URL="http://wiki.garrysmod.com/page/Structures/Color"]Color object[/URL], not 4 colors.
[QUOTE=G4MB!T;45400906]DButton:SetColor takes a [URL="http://wiki.garrysmod.com/page/Structures/Color"]Color object[/URL], not 4 colors.[/QUOTE]
Thanks :D
Sorry, you need to Log In to post a reply to this thread.