Players cant damage own 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.

iStopcontact

Member
Feb 18, 2017
115
2
18
Hey guys, I am working on my own minecraft server and i am working on a minigame.
I have 2 teams, for example: Team 1 and Team 2

What i want:
- Players from team 1 can't hit other players from team 1
- Players from team 1 can hit players from team 2
- Players from team 2 can't hit other players from team 2
- Players from team 2 can hit players from team 1

All the players in team 1 get added in variable: {team1::*}
All the players in team 2 get added in the variable: {team2::*}

Example code:
code_language.skript:
add player to {team1::*}
or
code_language.skript:
add player to {team2::*}

Can someone help me how i can put in my code that you cant hit your own team.
 
Permissions would work, but it would probably be better to assign a variable to each player that indicates their team. ex:

code_language.skript:
set {team.%player%} to "team1"

on damage:
    if {team.%attacker%} is {team.%victim%}:
        cancel event
 
Permissions would work, but it would probably be better to assign a variable to each player that indicates their team. ex:

code_language.skript:
set {team.%player%} to "team1"

on damage:
    if {team.%attacker%} is {team.%victim%}:
        cancel event
For the love of the Lord of cats, use lists variables for technically every in Skript, it's for many reasons I'm tired to say.
 
He means use {team::%player%}. I never saw the point in using a list variable if it's not a list of something. Maybe snow-pyon would like to enlighten us?
 
He means use {team::%player%}. I never saw the point in using a list variable if it's not a list of something. Maybe snow-pyon would like to enlighten us?
I always suggest list variables because:
  • Them can be looped
  • you can delete every value from it just doing "clear {yourListPrefix:::*}
  • it makes a lot easier the creation of a top 10 and something like that.
  • when looped, you can get that player by using loop-index which is really useful
And many other reasons, but these ones should be the main ones.
 
Status
Not open for further replies.