• Trying out halo.Add But got stuck
    8 replies, posted
Hey, I have been experimenting with halo.Add and I like it alot! But only when I look at the entity then basicly all the entities that are "pistol_ammo" light up. I only want the specific one that I'm looking at to light up. How do I do this? [LUA] function GM:PreDrawHalos() local client = LocalPlayer() local tr = client:GetEyeTrace().Entity:GetPos():Distance(client:GetPos()) < 101 if LocalPlayer():GetEyeTrace().Entity:GetClass() == "ammo_pistol" then local entL = ents.FindByClass( "ammo_pistol" ) for k,v in pairs(entL) do if tr then halo.Add(entL, Color(0, 0, 255), 5, 5, 2, true, false) end end end end [/LUA] [IMG]http://i.imgur.com/y8D3H2e.jpg[/IMG]
Because you're looping through every ammo_pistol?
Hey, I'm not good with tables. How do I make it so it doesn't loop
[code]function GM:PreDrawHalos() local client = LocalPlayer() local tr = client:GetEyeTrace().Entity:GetPos():Distance(client:GetPos()) < 101 if LocalPlayer():GetEyeTrace().Entity:GetClass() == "ammo_pistol" then local entL = LocalPlayer():GetEyeTrace() for k,v in pairs(entL) do if tr and v.Entity then halo.Add(v.Entity, Color(0, 0, 255), 5, 5, 2, true, false) end end end end[/code]
Nope, halo.Add Function requires a table.
[QUOTE=reenesj;42959999]Nope, halo.Add Function requires a table.[/QUOTE] Edited my post Edit: Doesn't work, hold on..
Hey, Sorry I'm going to have to dissapoint you again. It did not work. :( Maybe try testing it yourself before you get loads of "dumb" ratings
[QUOTE=reenesj;42960285]Hey, Sorry I'm going to have to dissapoint you again. It did not work. :([/QUOTE] I know, I'm working on it right now. [editline]23rd November 2013[/editline] [code]function GM:PreDrawHalos() local client = LocalPlayer() local tr = client:GetEyeTrace().Entity:GetPos():Distance(client:GetPos()) < 101 if LocalPlayer():GetEyeTrace().Entity:GetClass() == "item_ammo_pistol" then local ent = LocalPlayer():GetEyeTrace().Entity local tab = {} table.insert( tab, ent ) if tr then halo.Add(tab, Color(0, 0, 255), 5, 5, 2, true, false) end end end[/code] Works perfectly. [img]http://puu.sh/5rcE0.png[/img]
Thank you for the help!
Sorry, you need to Log In to post a reply to this thread.