Friendly fire?

Is there any way to make some code that says that you cant hurt anybody on your own team? sounds like it could just be a simple if then statement. if that works, then ill probably make it be able to work for Joining/connecting

Teams
Team_1 (RED team)
Team_2 (BLUE team)
Joining/connecting(no actual “team”, just make it so than nobody can hurt a “team_3”, ill make it so that people spawn as that while choosing :smiley:
maybe even just turn on godmode for them…)
Thanks!

Well, wouldn’t you hook into **[Entity.TakeDamage

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.TakeDamage)** and change the damage if the player is on the same team?

I told you how to do this already. It’s not difficult…
[lua]
–Same team shouldn’t take damage (no ff)
function GM:PlayerShouldTakeDamage(pl, attacker)
if (attacker.SendLua) then
if (attacker:Team() == pl:Team()) then
return attacker == pl
end
end
return true
end
[/lua]

[lua]
function GM:PlayerShouldTakeDamage( ply, attacker )
if (attacker:IsPlayer()) then
if(attacker:Team() == ply:Team()) then
return false
end
end
end
[/lua]
meh should work :stuck_out_tongue:

xD I like your IsPlayer check!

Works Perfect. thanks.
one more thing if its not too hard. more like two
a Headshot system that works with all weps, and plays the quake headshot sound when it occurs.
a simple player trail displaying the wearers color, since its a bit hard to tell from far away.
thanks for the first snippet. much appreciated