• DarkRP Team Kill
    10 replies, posted
I am having problems with Teamkilling on my server, I don't want Robbers to kill Swats, At the moment i have this: [CODE]hook.Add("PlayerShouldTakeDamage", "DisableFriendlyFire", function( ply, victim ) if ply:IsPlayer() and victim:IsPlayer() then if team.GetName(ply:Team()):lower():find("cp",1,true) and team.GetName(victim:Team()):lower():find("cp",1,true) then return false end if team.GetName(ply:Team()):lower():find("Robber",1,true) and team.GetName(victim:Team()):lower():find("Robber",1,true) then return false end end end)[/CODE] ^^ This works with only robbers and not cps :/ My Teams are: TEAM_SWAT1 - 21 and TEAM_ROBBER1 - 21 the become job command is cp1 - 21 and robber 1 - 21 [CODE]hook.Add("EntityTakeDamage", "TeamDamage", function( target, dmginfo ) if target:IsPlayer() then if target:Team() == TEAM_ROBBER1 or target:Team() == TEAM_ROBBER2 or target:Team() == TEAM_ROBBER3 or target:Team() == TEAM_ROBBER4 or target:Team() == TEAM_ROBBER5 or target:Team() == TEAM_ROBBER6 or target:Team() == TEAM_ROBBER7 or target:Team() == TEAM_ROBBER8 or target:Team() == TEAM_ROBBER9 or target:Team() == TEAM_ROBBER10 or target:Team() == TEAM_ROBBER11 or target:Team() == TEAM_ROBBER12 or target:Team() == TEAM_ROBBER13 or target:Team() == TEAM_ROBBER14 or target:Team() == TEAM_ROBBER15 or target:Team() == TEAM_ROBBER16 or target:Team() == TEAM_ROBBER17 or target:Team() == TEAM_ROBBER18 or target:Team() == TEAM_ROBBER19 or target:Team() == TEAM_ROBBER20 or target:Team() == TEAM_ROBBER21 and dmginfo:GetAttacker():Team() == TEAM_ROBBER1 or dmginfo:GetAttacker():Team() == TEAM_ROBBER2 or dmginfo:GetAttacker():Team() == TEAM_ROBBER3 or dmginfo:GetAttacker():Team() == TEAM_ROBBER4 or dmginfo:GetAttacker():Team() == TEAM_ROBBER5 or dmginfo:GetAttacker():Team() == TEAM_ROBBER6 or dmginfo:GetAttacker():Team() == TEAM_ROBBER7 or dmginfo:GetAttacker():Team() == TEAM_ROBBER8 or dmginfo:GetAttacker():Team() == TEAM_ROBBER9 or dmginfo:GetAttacker():Team() == TEAM_ROBBER10 or dmginfo:GetAttacker():Team() == TEAM_ROBBER11 or dmginfo:GetAttacker():Team() == TEAM_ROBBER12 or dmginfo:GetAttacker():Team() == TEAM_ROBBER13 or dmginfo:GetAttacker():Team() == TEAM_ROBBER14 or dmginfo:GetAttacker():Team() == TEAM_ROBBER15 or dmginfo:GetAttacker():Team() == TEAM_ROBBER16 or dmginfo:GetAttacker():Team() == TEAM_ROBBER17 or dmginfo:GetAttacker():Team() == TEAM_ROBBER18 or dmginfo:GetAttacker():Team() == TEAM_ROBBER19 or dmginfo:GetAttacker():Team() == TEAM_ROBBER20 or dmginfo:GetAttacker():Team() == TEAM_ROBBER21 then dmginfo:ScaleDamage( 0 ) end if target:Team() == TEAM_POLICE1 or target:Team() == TEAM_POLICE2 or target:Team() == TEAM_POLICE3 or target:Team() == TEAM_POLICE4 or target:Team() == TEAM_POLICE5 or target:Team() == TEAM_POLICE6 or target:Team() == TEAM_POLICE7 or target:Team() == TEAM_POLICE8 or target:Team() == TEAM_POLICE9 or target:Team() == TEAM_POLICE10 or target:Team() == TEAM_POLICE11 or target:Team() == TEAM_POLICE12 or target:Team() == TEAM_POLICE13 or target:Team() == TEAM_POLICE14 or target:Team() == TEAM_POLICE15 or target:Team() == TEAM_POLICE16 or target:Team() == TEAM_POLICE17 or target:Team() == TEAM_POLICE18 or target:Team() == TEAM_POLICE19 or target:Team() == TEAM_POLICE20 or target:Team() == TEAM_POLICE21 and dmginfo:GetAttacker():Team() == TEAM_POLICE1 or dmginfo:GetAttacker():Team() == TEAM_POLICE2 or dmginfo:GetAttacker():Team() == TEAM_POLICE3 or dmginfo:GetAttacker():Team() == TEAM_POLICE4 or dmginfo:GetAttacker():Team() == TEAM_POLICE5 or dmginfo:GetAttacker():Team() == TEAM_POLICE6 or dmginfo:GetAttacker():Team() == TEAM_POLICE7 or dmginfo:GetAttacker():Team() == TEAM_POLICE8 or dmginfo:GetAttacker():Team() == TEAM_POLICE9 or dmginfo:GetAttacker():Team() == TEAM_POLICE10 or dmginfo:GetAttacker():Team() == TEAM_POLICE11 or dmginfo:GetAttacker():Team() == TEAM_POLICE12 or dmginfo:GetAttacker():Team() == TEAM_POLICE13 or dmginfo:GetAttacker():Team() == TEAM_POLICE14 or dmginfo:GetAttacker():Team() == TEAM_POLICE15 or dmginfo:GetAttacker():Team() == TEAM_POLICE16 or dmginfo:GetAttacker():Team() == TEAM_POLICE17 or dmginfo:GetAttacker():Team() == TEAM_POLICE18 or dmginfo:GetAttacker():Team() == TEAM_POLICE19 or dmginfo:GetAttacker():Team() == TEAM_POLICE20 or dmginfo:GetAttacker():Team() == TEAM_POLICE21 then dmginfo:ScaleDamage( 0 ) end end end)[/CODE] ^^ Thats the other one that a tried, exept that disables damage completely Please Help! P.S. My server is not really DarkRP its Based off darkrp and is more of a TDM
This function may be more convenient when checking if a player is civil protection or not.. [url]http://wiki.darkrp.com/index.php/Functions/player/shared/iscp[/url]
[QUOTE=Jeezy;44161094]This function may be more convenient when checking if a player is civil protection or not.. [url]http://wiki.darkrp.com/index.php/Functions/player/shared/iscp[/url][/QUOTE] Yes but i also want to restrict team killing between Robbers to
Why do you have 21 robber teams?
[QUOTE=Bo98;44161984]Why do you have 21 robber teams?[/QUOTE] Yes, it's a Team Death Match type gamemode that is based off DarkRP, Not DarkRP
Still, why do you need 21 teams? Doesn't matter if it's DarkRP or not.
Because otherwise i can't restrict Shipments and Entities to the jobs, it just does not work at all if i do only 1 team for 21 jobs :/ Also according to the better coders trying to help "it won't work with just one team".
I also am in need of something to disallow a custom job from killing its own team members, I'm going to try homeboys first solution and set it to own team, see if that works, but i don't know why it wouldn't.
i think his gamemode is robbers vs swats.
[QUOTE=Pie's;44160649] [CODE]hook.Add("EntityTakeDamage", "TeamDamage", function( target, dmginfo ) if target:IsPlayer() then if target:Team() == TEAM_ROBBER1 or target:Team() == TEAM_ROBBER2 or target:Team() == TEAM_ROBBER3 or target:Team() == TEAM_ROBBER4 or target:Team() == TEAM_ROBBER5 or target:Team() == TEAM_ROBBER6 or target:Team() == TEAM_ROBBER7 or target:Team() == TEAM_ROBBER8 or target:Team() == TEAM_ROBBER9 or target:Team() == TEAM_ROBBER10 or target:Team() == TEAM_ROBBER11 or target:Team() == TEAM_ROBBER12 or target:Team() == TEAM_ROBBER13 or target:Team() == TEAM_ROBBER14 or target:Team() == TEAM_ROBBER15 or target:Team() == TEAM_ROBBER16 or target:Team() == TEAM_ROBBER17 or target:Team() == TEAM_ROBBER18 or target:Team() == TEAM_ROBBER19 or target:Team() == TEAM_ROBBER20 or target:Team() == TEAM_ROBBER21 and dmginfo:GetAttacker():Team() == TEAM_ROBBER1 or dmginfo:GetAttacker():Team() == TEAM_ROBBER2 or dmginfo:GetAttacker():Team() == TEAM_ROBBER3 or dmginfo:GetAttacker():Team() == TEAM_ROBBER4 or dmginfo:GetAttacker():Team() == TEAM_ROBBER5 or dmginfo:GetAttacker():Team() == TEAM_ROBBER6 or dmginfo:GetAttacker():Team() == TEAM_ROBBER7 or dmginfo:GetAttacker():Team() == TEAM_ROBBER8 or dmginfo:GetAttacker():Team() == TEAM_ROBBER9 or dmginfo:GetAttacker():Team() == TEAM_ROBBER10 or dmginfo:GetAttacker():Team() == TEAM_ROBBER11 or dmginfo:GetAttacker():Team() == TEAM_ROBBER12 or dmginfo:GetAttacker():Team() == TEAM_ROBBER13 or dmginfo:GetAttacker():Team() == TEAM_ROBBER14 or dmginfo:GetAttacker():Team() == TEAM_ROBBER15 or dmginfo:GetAttacker():Team() == TEAM_ROBBER16 or dmginfo:GetAttacker():Team() == TEAM_ROBBER17 or dmginfo:GetAttacker():Team() == TEAM_ROBBER18 or dmginfo:GetAttacker():Team() == TEAM_ROBBER19 or dmginfo:GetAttacker():Team() == TEAM_ROBBER20 or dmginfo:GetAttacker():Team() == TEAM_ROBBER21 then dmginfo:ScaleDamage( 0 ) end if target:Team() == TEAM_POLICE1 or target:Team() == TEAM_POLICE2 or target:Team() == TEAM_POLICE3 or target:Team() == TEAM_POLICE4 or target:Team() == TEAM_POLICE5 or target:Team() == TEAM_POLICE6 or target:Team() == TEAM_POLICE7 or target:Team() == TEAM_POLICE8 or target:Team() == TEAM_POLICE9 or target:Team() == TEAM_POLICE10 or target:Team() == TEAM_POLICE11 or target:Team() == TEAM_POLICE12 or target:Team() == TEAM_POLICE13 or target:Team() == TEAM_POLICE14 or target:Team() == TEAM_POLICE15 or target:Team() == TEAM_POLICE16 or target:Team() == TEAM_POLICE17 or target:Team() == TEAM_POLICE18 or target:Team() == TEAM_POLICE19 or target:Team() == TEAM_POLICE20 or target:Team() == TEAM_POLICE21 and dmginfo:GetAttacker():Team() == TEAM_POLICE1 or dmginfo:GetAttacker():Team() == TEAM_POLICE2 or dmginfo:GetAttacker():Team() == TEAM_POLICE3 or dmginfo:GetAttacker():Team() == TEAM_POLICE4 or dmginfo:GetAttacker():Team() == TEAM_POLICE5 or dmginfo:GetAttacker():Team() == TEAM_POLICE6 or dmginfo:GetAttacker():Team() == TEAM_POLICE7 or dmginfo:GetAttacker():Team() == TEAM_POLICE8 or dmginfo:GetAttacker():Team() == TEAM_POLICE9 or dmginfo:GetAttacker():Team() == TEAM_POLICE10 or dmginfo:GetAttacker():Team() == TEAM_POLICE11 or dmginfo:GetAttacker():Team() == TEAM_POLICE12 or dmginfo:GetAttacker():Team() == TEAM_POLICE13 or dmginfo:GetAttacker():Team() == TEAM_POLICE14 or dmginfo:GetAttacker():Team() == TEAM_POLICE15 or dmginfo:GetAttacker():Team() == TEAM_POLICE16 or dmginfo:GetAttacker():Team() == TEAM_POLICE17 or dmginfo:GetAttacker():Team() == TEAM_POLICE18 or dmginfo:GetAttacker():Team() == TEAM_POLICE19 or dmginfo:GetAttacker():Team() == TEAM_POLICE20 or dmginfo:GetAttacker():Team() == TEAM_POLICE21 then dmginfo:ScaleDamage( 0 ) end end end)[/CODE] [/QUOTE] Oh my god, what the hell are you doing... :suicide:
[CODE] hook.Add("EntityTakeDamage", "DisableFriendlyFire", function( Target, Inflictor, Attacker ) if Target:Team() == Attacker:Team() then dmginfo:ScaleDamage( 0 ) end return dmginfo end) [/CODE] This should work, don't have the time to test it, but it technically should work.
Sorry, you need to Log In to post a reply to this thread.