• Image appearence on entities.
    6 replies, posted
local table =     {         _class = "func_button",         _image = "blabalbla.png"     }   hook.Add( "HUDPaint", "HUDPaint_DrawABox", function()       local trace = player:GetEyeTraceNoCursor().Entity     local distance = 128;       if LocalPlayer():Alive() then         if IsValid(trace) and (LocalPlayer:GetPos():Distance(trace:GetPos()) < distance) then             if table.HasValue(table, trace:GetClass()) then --Here must be a table of needed entities and func button here, and and if entitie is in table, then picture should be drawn on screen             end;         end;     end; end ) ^ this is the code me and my m8 done. But since I'm an idiot in coding after all, and my m8 wasnt able to figure out how check table should be made aswell as how to draw image when player is looking at something. Can you guys help me with this? I would be really greatfull.
You are overriding default table extension, so when you call table.HasValue it refers to your local table called table player is not defined You don't understand how table.HasValue works local aimEntityImages = { ["func_button"] = "blabalbla.png", } local distance = 128 hook.Add("HUDPaint", "DrawABox", function() local traceEntity = LocalPlayer():GetEyeTraceNoCursor().Entity if LocalPlayer():Alive() then if IsValid(traceEntity) and (LocalPlayer:GetPos():Distance(trace:GetPos()) < distance) then local img = aimEntityImages[traceEntity:GetClass()] if img then -- draw an image end end end end)
Mhm ... I'm pretty sure I either missed something or installed this wrong. I tried to put it into my autoran folder, but it didnt work for me. Sorry for being too dumb.
We're going to need more than "it didn't work for me"
Quite oblivious. There were no lua errors, m8, otherwise I would have posted them. Just nothing happens
Your code, file path?
sadly I'm not near my pic now to show you code, but I didn't change anything, aside from path to image. Checked it with working image, which is used and proved to be working. I also tried adding "print" command after "if Img then", to see if at least something happening when I look at func_button, but sadly nothing.
Sorry, you need to Log In to post a reply to this thread.