Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make an item work against only one group/team?

Asked by 8 years ago

I was wondering how I could get a specific item to work against only one specific team. I'm trying to get tasers, only used by police, to work only against criminals. Both Police and Criminals are teams. Plus, how can I make that item teleport only one team (criminals) to a specific spot (jail)?

Sorry, I have the code on my other computer and I think I may have deleted what I have.

1 answer

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
8 years ago

Anti-Teamkill scripts are pretty simple to do. Every weapon will have some sort of section of code on what to do when you hit someone. In that block, just compare your team and the person you hit's team.

if yourPlayer.TeamColor ~= personYouHit.TeamColor then
    --damage them
end

GetPlayerFromCharacter will likely come in handy.

Ad

Answer this question