Im trying to do that if an entity is transparent (like alpha 190 or less), a halo is drawn around it. (This is being run clientside btw) and i’ve tried many ways to do it, by using the GetAll() and then v:GetColor() but for some reason it doesn’t work. I tried printing the v:GetColor() and it printed me, instead of a color table, something like.
table: 0x546e9e48
table: 0x4392df30
table: 0x55b3f1a0
table: 0x54c0a6c8
table: 0x55af5a18
table: 0x5588c300
table: 0x473b7c68
which I supose is something like a “table ID”?
I also thought about using traces but the trace result table doesn’t return anything like the color.
Something I thought about is doing a code in all entities that is like:
if self.GetColor() == Color(0,0,0,190) then
[draw the halo]
But I don’t know how to do that, and i didn’t find any answers online or in the wiki, on how to run code in all the entities (which is something I’m sure it’s not that hard to do because It’s pretty useful)
Here is the code of the getall and getcolor.
hook.Add("Think", "colorGet", function()
for k,v in pairs(ents.GetAll()) do
if v:GetColor() == Color(0,0,0,190) then
print("testwork")
halo.Add(ents.GetAll(), Color(255,0,0,255), 5, 5,30, true, true )
end
end
end)
This is for my server because it’s annoying when someone gets the color tool and uses it to make something invisible,to help with the administration of my server, and I also had the chance to try to code, but I got stuck with this.
EDIT: Solved it, just did some messing around with tables, here’s the code:
wantHolo = {}
transparencia = 180
hook.Add("Think", "colorGet", function()
enties = ents.FindByClass("prop_physics")
for k,v in pairs(enties) do
if v:GetColor().a <= transparencia then
table.insert(wantHolo,v)
end
if v:GetColor().a > transparencia then
table.remove(wantHolo,k)
end
end
end)
hook.Add("Think","drawear",function()
halo.Add(wantHolo, Color(255,0,0,255), 5, 5,30, true, true )
end)