• Friendly fire?
    5 replies, posted
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 :D maybe even just turn on godmode for them..) Thanks!
Well, wouldn't you hook into [b][url=http://wiki.garrysmod.com/?title=Entity.TakeDamage]Entity.TakeDamage [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] 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 :P
[QUOTE=mr.wolf;23346547]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][/QUOTE] 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
Sorry, you need to Log In to post a reply to this thread.