Lua code help

Posts 1–6 of 6 · Page 1 of 1
Lua code help
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)
Code:
halo.Add(ents.FindByClass("npc_*"), Color(whfarbenpc), 2, 2, 2, true, true)
- - - Updated - - -

Code:
whfarbenpc=("0, 0, 255")
:65: ')' expected near '='
Code:
local wh = false
local whfarbenpc = Color(0, 0, 255)
local blue = Color(0, 0, 255)

concommand.Add("kl_farbe", function()
	local whmenu = vgui.Create("DFrame")
	whmenu:SetPos(20, 5)
	whmenu:SetSize(400, 300)
	whmenu:SetTitle("whfarbmenu")
	whmenu:MakePopup()

	local whfarbmenu = vgui.Create("DColorMixer", whmenu)
	whfarbmenu:SetPos(50, 50)
	whfarbmenu:SetSize(300, 300)

	local 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()
	wh = !wh
end)

hook.Add("PreDrawHalos", "kl_wh", function()
	if !(wh) then return end
	
	for i, ent in ipairs(ents.GetAll()) do
		if (ent:IsNPC()) then
			halo.Add({ent}, whfarbenpc, 2, 2, 1, true, true)
		elseif (ent:IsPlayer()) then
			halo.Add({ent}, blue, 2, 2, 1, true, true)
		end
	end
end)
this didnt help him learn at all you just pasted a fix for him lol
Quote Originally Posted by iMythik View Post
this didnt help him learn at all you just pasted a fix for him lol
who the hell cares
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us