• how to give a player an outline
    10 replies, posted
I'm making a swep and I want to make a team be able to "mark" targets, the player right clicks on an enemy player and he gets an outline or an arrow above their head that other players on the same team can see through walls and such. I don't have any idea how to do this so, can you help a noob out?
This will outline the player, but you have to get the player's object. [code] ply:DrawEntityOutline( 1.0 ) [/code]
so something like: [lua]for k,v in pairs(Player.GetAll()) do pl:DrawEntityOutline(1.0) end[/lua]
[QUOTE=Carmine3777;24240815]so something like: [lua]for k,v in pairs(player.GetAll()) do v:DrawEntityOutline(1.0) end[/lua][/QUOTE] Just correcting.
[QUOTE=Cubar;24242170]Just correcting.[/QUOTE] thanks, I forgot that you can only use v: and not pl:
[QUOTE=Carmine3777;24242416]thanks, I forgot that you can only use v: and not pl:[/QUOTE] You could do pl for example [lua] function RocketAll(ply) for _,pl in pairs(player.GetAll()) do -- as long as ply isn't here it's good to use pl:SetVelocity(Vector(0,0,1000)) timer.Simple(1.5, function() pl:Kill() end) end end concommand.Add("players_go_swoosh", RocketAll) [/lua] Hope that helps
[QUOTE=Cubar;24242559]You could do pl for example [lua] function RocketAll(ply) for _,pl in pairs(player.GetAll()) do -- as long as ply isn't here it's good to use pl:SetVelocity(Vector(0,0,1000)) timer.Simple(1.5, function() pl:Kill() end) end end concommand.Add("players_go_swoosh", RocketAll) [/lua] Hope that helps[/QUOTE] thanks for clearing that up for me, so the SetVelocity pushes them up 1000 units and the timer is there so they can fly up before dying.
[QUOTE=Carmine3777;24242817]thanks for clearing that up for me, so the SetVelocity pushes them up 1000 units and the timer is there so they can fly up before dying.[/QUOTE] Correct
so, tying that in with my other post I could do this: [lua]hook.Add( "Think", "PlayerOutline", function() for k, v in pairs(player.GetAll()) do if ( v:IsRunning() && v:Team() == 2 ) then v:DrawEntityOutline(1.0) end end end)[/lua]
Yes, if DrawEntityOutline colors them in white you might want to use HUDPaint instead of Think.
thanks, you helped me learn a few new tricks and helped me out on my gamemode, I was going to make a swep that marks targets, but I also wanted to make the players be easy to see when running. [editline]01:36PM[/editline] how would I give the outline a color, because it isn't showing up when I go into thirdperson on team 2
Sorry, you need to Log In to post a reply to this thread.