Solved Not being able to hit other players in a team?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

JackyBoy

Member
Feb 4, 2017
104
1
18
Hey there! I am making a small PVP game and I need 2 teams (Green & Blue) is there a way so that players in one team can only hit the other team members?
 
Hey there! I am making a small PVP game and I need 2 teams (Green & Blue) is there a way so that players in one team can only hit the other team members?
You can add the players into blue variable or green variable and verify on damage.

Example code:
code_language.skript:
command /join <text>:
    trigger:
        if arg 1 is "green":
             set {pvp.%player%.team} to "green"
        if arg 1 is "blue":
             set {pvp.%player%.team} to "blue"

on damage:
    if {pvp.%victim%.team} is equal to {pvp.%attacker%.team}:
        cancel event

You can also add them into a list variables if you prefer saving them into a list.
 
Thanks but this does not work you can still hit players even if you are on the same team
 
code_language.skript:
command team <text>:
    usage: /team green/blue
    trigger:
        arg 1 is "green":
            set {pvp::team::%player%} to "green"
        arg 1 is "blue":
            set {pvp::team::%player%} to "green"
            
on damage:
    damager is a player
    victim is a player
    "%{pvp::team::%victim%}%" = "%{pvp::team::%damager%}%":
        cancel the event
        send "You are in the same team!" to damager
        
on quit:
    delete {pvp::team::%player%}
 
Status
Not open for further replies.