• Draw client lines between players
    2 replies, posted
So I wanted to draw lines between players for my SCP Server, so when you see SCP-096 the player (as SCP-096) will have a line drawn from his position to the player(s)'s position who has seen him. I've problems with the "draw line" part. Here what I tried but didn't work. [CODE]hook.Add("HUDPaint", "drawlines096", function() if LocalPlayer():Team() == TEAM_SCP096 then for k,v in pairs(player.GetAll()) do if v:GetNWBool("seenby096") then render.DrawLine( LocalPlayer():GetPos(), v:GetPos(), Color(255,0,0,255), true) end end end end)[/CODE]
Render.DrawLine uses a 3D context when HUDPaint is only a 2D context, change the hook to PreDrawOpaqueRenderables or something (on my mobile so you should probably look up the actual name of that hook)
Thanks ! I've made that and it works: [CODE]hook.Add("PreDrawOpaqueRenderables", "drawlines096", function() if LocalPlayer():Team() == TEAM_SCP096 then for k,v in pairs(player.GetAll()) do if v:GetNWBool("seenby096") then render.DrawLine( LocalPlayer():GetPos() + Vector( 0, 0, 0.001 ), v:EyePos() + Vector( 0, 0, 0.001 ), Color(255,0,0,255), true) render.DrawLine( LocalPlayer():GetPos() + Vector( 0, 0.001, 0 ), v:EyePos() + Vector( 0, 0.001, 0 ), Color(255,0,0,255), true) render.DrawLine( LocalPlayer():GetPos() + Vector( 0.001, 0, 0 ), v:EyePos() + Vector( 0.001, 0, 0 ), Color(255,0,0,255), true) end end end end)[/CODE]
Sorry, you need to Log In to post a reply to this thread.