• Draw Halos
    2 replies, posted
Hello! I am trying to do some simple halo outlines for my TTT server, but they aren't working. I really don't see anything wrong with this code, plus there are no errors on the server, but they just aren't showing up. [code] function DrawHalos() hook.Add( "PreDrawHalows", "AddHalos", function() for k, v in pairs( player.GetAll() ) do if LocalPlayer():GetRole() == ROLE_TRAITOR or v:GetRole() == ROLE_TRAITOR then halo.Add( ents.FindByClass( "ttt_c4" ), Color( 155, 55, 55 ), 5, 5, 2, false, true) elseif LocalPlayer():GetRole() == ROLE_TRAITOR or v:GetRole() == ROLE_TRAITOR then halo.Add( ents.FindByClass( "npc_tripmine" ), Color( 155, 55, 55 ), 5, 5, 2, false, true) end end for k, v in pairs( player.GetAll() ) do if LocalPlayer():GetRole() == ROLE_TRAITOR and v:GetRole() == ROLE_TRAITOR then halo.Add({v}, Color( 155, 55, 55 ), 5, 5, 2, false, true) end end for k, v in pairs( player.GetAll() ) do if v:GetRole() == ROLE_DETECTIVE then halo.Add({v}, Color( 55, 85, 155 ), 5, 5, 2, false, false) end end for k, v in pairs( player.GetAll() ) do if v.sb_tag.txt == "sb_tag_friend" then halo.Add({v}, Color( 0, 255, 0 ), 5, 5, 2, false, false) elseif v.sb_tag.txt == "sb_tag_susp" then halo.Add({v}, Color( 255, 255, 0 ), 5, 5, 2, false, false) elseif v.sb_tag.txt == "sb_tag_avoid" then halo.Add({v}, Color( 255, 150, 0 ), 5, 5, 2, false, false) elseif v.sb_tag.txt == "sb_tag_kill" then halo.Add({v}, Color( 255, 0, 0 ), 5, 5, 2, false, false) elseif v.sb_tag.txt == "sb_tag_miss" then halo.Add({v}, Color( 130, 190, 130 ), 5, 5, 2, false, false) else halo.Add({v}, Color( 55, 55, 55 ), 5, 5, 1, false, false) end end end) end hook.Add( "TTTBeginRound", "DrawHalos", DrawHalos ) [/code] Any ideas?
Wrong hook; They needed to be added each frame. PreDrawHalos should be the right hook.
[lua]hook.Add( "PreDrawHalows", "AddHalos", function()[/lua] [lua]"PreDrawHalows"[/lua] [lua]Halows[/lua]
Sorry, you need to Log In to post a reply to this thread.