So I tried coding a simple Wallhack in which you can choose the color, but it isnt working.
I tried everything I could but could not solve it as im new to lua.
I can choose the color and the window closes as it should but when i start the "wallhack" i get this error message:
bad argument #1 to 'min' (number expected, got nil)
for line 65
code:
Code:
wh = false
concommand.Add("kl_farbe", function()
whmenu = vgui.Create("DFrame") --Menü WallHack
whmenu:SetPos(20, 5)
whmenu:SetSize(400, 300)
whmenu:SetTitle("whfarbmenu")
whmenu:SetVisible(true)
whmenu:SetDraggable(true)
whmenu:ShowCloseButton(true)
whmenu:MakePopup()
whfarbmenu = vgui.Create("DColorMixer", whmenu) --WallHack Farbmenü
whfarbmenu:SetPos(50, 50)
whfarbmenu:SetSize(300, 300)
whfarbmenu:SetPalette(true)
whfarbmenu:SetAlphaBar(true)
whfarbmenu:SetColor( Color(255, 255, 255))
whfarbmenuknopf = vgui.Create("DButton", whmenu)
whfarbmenuknopf:SetText("Fertig")
whfarbmenuknopf:SetSize(90, 30)
whfarbmenuknopf:SetPos(100, whmenu:GetTall() - 40)
whfarbmenuknopf.DoClick = function()
whfarbenpc = whfarbmenu:GetColor()
whmenu:Close()
end
end)
concommand.Add("kl_togglewh", function(whfarbenpc) --WallHack
if wh==true then
hook.Remove("PreDrawHalos", "kl_wh")
wh=false
else
hook.Add("PreDrawHalos", "kl_wh", function()
if whfarbenpc==nil then
whfarbenpc=("0, 0, 255")
end
halo.Add(ents.FindByClass("npc_*"), Color(whfarbenpc), 2, 2, 2, true, true)
halo.Add(player.GetAll(), Color(0, 0, 255), 2, 2, 2, true, true)
wh=true
end)
end
end)