Thread: Lua code help

Results 1 to 6 of 6
  1. #1
    klonartur's Avatar
    Join Date
    Oct 2016
    Gender
    male
    Location
    Under the carpet
    Posts
    6
    Reputation
    10
    Thanks
    0
    My Mood
    Twisted

    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)

  2. #2
    Cyaegha's Avatar
    Join Date
    Aug 2016
    Gender
    male
    Posts
    536
    Reputation
    17
    Thanks
    526
    Code:
    halo.Add(ents.FindByClass("npc_*"), Color(whfarbenpc), 2, 2, 2, true, true)
    - - - Updated - - -

    Code:
    whfarbenpc=("0, 0, 255")

  3. #3
    klonartur's Avatar
    Join Date
    Oct 2016
    Gender
    male
    Location
    Under the carpet
    Posts
    6
    Reputation
    10
    Thanks
    0
    My Mood
    Twisted
    :65: ')' expected near '='

  4. #4
    Cyaegha's Avatar
    Join Date
    Aug 2016
    Gender
    male
    Posts
    536
    Reputation
    17
    Thanks
    526
    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)

  5. The Following User Says Thank You to Cyaegha For This Useful Post:

    klonartur (05-09-2017)

  6. #5
    iMythik's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    188
    Reputation
    15
    Thanks
    3,226
    this didnt help him learn at all you just pasted a fix for him lol
    got my account back

  7. #6
    meme420's Avatar
    Join Date
    Dec 2015
    Gender
    female
    Posts
    54
    Reputation
    10
    Thanks
    11
    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

Similar Threads

  1. [Solved] Lua Coding help
    By cooper the troopa in forum Garry's Mod Coding & Resources
    Replies: 6
    Last Post: 05-21-2016, 03:10 PM
  2. [Solved] (Garry's Mod) Lua coding help me
    By cooper the troopa in forum Garry's Mod Coding & Resources
    Replies: 2
    Last Post: 05-07-2016, 09:30 AM
  3. [Help] I need help debugging a nil script (Lua coding)
    By TearInHeaven in forum Other Programming
    Replies: 0
    Last Post: 03-16-2015, 04:06 PM
  4. I Need Help Making A Program To Run My .LUA Code For Payday 2.
    By fraxer91 in forum Payday 2 Hacks & Cheats
    Replies: 6
    Last Post: 10-28-2013, 03:17 PM
  5. [Help Request] GSC coding help
    By Brabomclaren in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 4
    Last Post: 06-12-2011, 03:05 AM