• Remove Halos on death?
    4 replies, posted
I want to show halos of people while they're alive but for some reason they persist in death, even though I've checked for if the player is alive or not. hook.Add( "PreDrawHalos", "AddOutline", function() for k,v in pairs(player.GetAll()) do if v:Alive() == true then if humansAlive == 1 or LocalPlayer():Team() == v:Team() and v:Alive() then halo.Add(team.GetPlayers(v:Team()), team.GetColor(v:Team()), 2, 2, 2,true,true) else if LocalPlayer():Team() != v:Team() then halo.Add(team.GetPlayers(v:Team()), team.GetColor(v:Team()), 2, 2, 2,true,false) end end else end end end)
Because you're adding the Halo to an entire team, it only takes one player to be alive on a team to have the halo on everybody.
Changing team.GetPlayers(v:Team()) to just v pops with an error since halo.add expects a table and not userdata. Indexing the table doesn't seem to work either. [ERROR] lua/includes/modules/halo.lua:71: bad argument #1 to 'pairs' (table expected, got userdata)   1. pairs - [C]:-1    2. Render - lua/includes/modules/halo.lua:71     3. v - lua/includes/modules/halo.lua:153      4. unknown - lua/includes/modules/hook.lua:84
halo.Add(team.GetPlayers({v}, team.GetColor(v:Team()), 2, 2, 2,true,false) Alternatively I suppose you could filter through all the alive players and pop them in a table
[Lua] hook.Add("PreDrawHalos", "AddOutline", function() for.. Included two examples, I'm not sure how taxing halo.Add is compared to a nested loop
Sorry, you need to Log In to post a reply to this thread.