Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Three different options for ignoring police players for police NPCs. Use only the one that is most suitable, or modify it for yourself.
- local _isValid = IsValid
- hook.Add('BGN_PreReactionTakeDamage', 'BGN_DarkRPPoliceTeamIgnore', function(attacker, target)
- if not _isValid(attacker) or not attacker:IsPlayer() or not attacker:isCP() then return end
- local actor = bgNPC:GetActor(target)
- if actor and actor:HasTeam('police') then return true end
- end)
- local _isValid = IsValid
- hook.Add('BGN_PreReactionTakeDamage', 'BGN_DarkRPPoliceTeamIgnore', function(attacker, target)
- if not _isValid(attacker) or not attacker:IsPlayer() or attacker:Team() ~= TEAM_POLICE then return end
- local actor = bgNPC:GetActor(target)
- if actor and actor:HasTeam('police') then return true end
- end)
- local _isValid = IsValid
- local _valid_teams, _table_HasValueBySeq
- hook.Add('BGN_PreReactionTakeDamage', 'BGN_DarkRPPoliceTeamIgnore', function(attacker, target)
- if not _isValid(attacker) or not attacker:IsPlayer() then return end
- local actor = bgNPC:GetActor(target)
- if not actor or not actor:HasTeam('police') then return end
- _valid_teams = _valid_teams or { TEAM_POLICE }
- _table_HasValueBySeq = _table_HasValueBySeq or table.HasValueBySeq
- if _table_HasValueBySeq(_valid_teams, attacker:Team()) then return true end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement