1. 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 comminuty!

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

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Team Hearts

Discussion in 'Skript' started by Lennart Raff, Sep 16, 2019.

Thread Status:
Not open for further replies.
  1. Lennart Raff

    Lennart Raff Member

    Joined:
    Sep 16, 2019
    Messages:
    3
    Likes Received:
    0
    Hey guys,
    I created a Skript where you can join a team. Now i want everybody in the team to get damage if someone else gets damage. So that they all share a specific amount of hearts! Can you help me?
    This is what i tried. But it didnt work:


    on damage of a player:
    if {team.in.%player%} = "1":
    loop all players:
    if {team.in.%player%} = {team.in.%loop player%}:
    damage loop player

     
  2. Best Answer:
    Post #4 by couger44, Sep 17, 2019
  3. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    Can you send the full code?
     
  4. Lennart Raff

    Lennart Raff Member

    Joined:
    Sep 16, 2019
    Messages:
    3
    Likes Received:
    0
    Sure: (Messages are in german)

    Code (Text):
    1. options:
    2.  
    3.     #PREFIX
    4.    
    5.     prefix: &8[&2&lTeams&8]
    6.  
    7.     #MESSAGES
    8.    
    9.     already-with-the-name: &aDieses Team gibt es bereits
    10.     successfully-created: &aDu hast erfolgreich das Team &b'%message%&b' &aerstellt
    11.     you-are-in-a-team: &aDu bist bereits in einem Team benutze bitte /team leave wenn du ein weiteres erstellen willst
    12.     please-type-the-name: &aSchreibe bitte den Namen des Teams in den Chat
    13.     you-are-not-in-a-team: &aDu bist derzeit in keinem Team
    14.     successfully-sent-invite: &aDu hast erfolgreich &b%arg-2% &ain dein Team eingeladen
    15.     cant-invite-this-time: &cDu kannst &b%arg-2% &cderzeit nicht einladen...versuch es später nochmal
    16.     invited-has-a-team: &b%arg-2% &chat bereits ein Team
    17.     successfully-joined: &aDu bist erfolgreich dem Team '&b%{teams.invited.to.%player%}%&f' &2&lbeigetreten
    18.     havent-received-any-invite: &cDu hast keine Einladung erhalten
    19.     successfully-declined: &aDu hast die Einladung zum Team '&b%{teams.invited.to.%player%}%&f'&c&labgelehnt
    20.     friendly-fire: &aFriendly-Fire &cist nicht eingeschaltet
    21.     successfully-left: &aDu hast erfolgreich dein Team verlassen
    22.     no-permission: &cDas darfst du leider nicht
    23.    
    24.     #INVITE LINES
    25.    
    26.     invite-line-1: &b%player% &ahat dich eingeladen seinem Team beizutreten
    27.     invite-line-2: &aNutze '&b/team accept&f' &aum anzunehmen
    28.     invite-line-3: &aNutze '&b/team decline&f' &aum abzulehnen
    29.    
    30. on first join:
    31.     set {team.in.%player%} to "0"
    32.  
    33. on chat:
    34.     cancel event
    35.     if {team.in.%player%} = "1":
    36.         broadcast "&a%{team.%player%}% &b| %colored player's prefix% &7%player% &8» %message%"
    37.     else:
    38.         broadcast "%colored player's prefix% &7%player% &8» %message%"
    39.        
    40. on chat:
    41.     if {team.creating.%player%} = "1":
    42.         if {team.in.%player%} = "0":
    43.             if {team.%message%} is true:
    44.                 send "{@Prefix} {@already-with-the-name}"
    45.             else:
    46.                 set {team.in.%player%} to "1"
    47.                 set {team.%player%} to "%message%"
    48.                 set {team.%message%} to true
    49.                 send "{@Prefix} {@successfully-created}"
    50.                 set {team.creating.%player%} to "0"
    51.         else:
    52.             send "{@Prefix} {@you-are-in-a-team}"
    53.            
    54. command /superleave:
    55.     trigger:
    56.         if player has permission "teams.admin":
    57.             set {team.in.%player%} to "0"
    58. on join:
    59.     set {team.creating.%player%} to "0"
    60.     set {team.invited.%player%} to "0"
    61.  
    62. command /team [<text>] [<player>]:
    63.     trigger:
    64.         if arg-1 is "create":
    65.             if {team.in.%player%} = "0":
    66.                 send "{@prefix} {@please-type-the-name}"
    67.                 set {team.creating.%player%} to "1"
    68.             else:
    69.                 send "{@prefix} {@you-are-in-a-team}"
    70.         if arg-1 is "leave":
    71.             if {team.in.%player%} = "1":
    72.                 delete {team.%player%}
    73.                 set {team.in.%player%} to "0"
    74.                 send "{@prefix} {@successfully-left}"
    75.             else:
    76.                 send "{@prefix} {@you-are-not-in-a-team}"
    77.         if arg-1 is "invite":
    78.             if {team.in.%player%} = "1":
    79.                 if {team.in.%arg-2%} = "0":
    80.                     if {team.invited.%arg-2%} = "0":
    81.                         set {team.invited.%arg-2%} to "1"
    82.                         set {team.invited.to.%arg-2%} to "%{team.%player%}%"
    83.                         wait 1 tick
    84.                         send "{@prefix} {@invite-line-1}" to arg-2
    85.                         wait 1 tick
    86.                         send "{@prefix} {@invite-line-2}" to arg-2
    87.                         wait 1 tick
    88.                         send "{@prefix} {@invite-line-3}" to arg-2
    89.                         wait 1 tick
    90.                         send "{@prefix} {@successfully-sent-invite}"
    91.                     else:
    92.                         send "{@prefix} {@cant-invite-this-time}"
    93.                 else:
    94.                     send "{@prefix} {@invited-has-a-team}"
    95.             else:
    96.                 send "{@prefix} {@you-are-not-in-a-team}"
    97.         if arg-1 is "accept":
    98.             if {team.invited.%player%} = "1":
    99.                 if {team.in.%player%} = "0":
    100.                     set {team.in.%player%} to "1"
    101.                     set {team.%player%} to "%{team.invited.to.%player%}%"
    102.                     send "{@prefix} {@successfully-joined}"
    103.                     delete {team.invited.to.%player%}
    104.                     set {team.invited.%player%} to "0"
    105.                 else:
    106.                     send "{@prefix} {@you-are-in-a-team}"
    107.             else:
    108.                 send "{@prefix} {@havent-received-any-invite}"
    109.         if arg-1 is "decline":
    110.             if {team.invited.%player%} = "1":
    111.                 send "{@prefix} {@successfully-declined}"
    112.                 set {team.invited.%player%} to "0"
    113.                 delete {team.invited.to.%player%}
    114.             else:
    115.                 send "{@prefix} {@havent-received-any-invite}"
    116.         if arg-1 is not set:
    117.             send "&f----------------- &8Hilfe &7| &2&lTeams &f-------------------"
    118.             send "&2/team create &8» &aErstelle dein eigenes Team"
    119.             send "&2/team leave &8» &aVerlasse dein aktuelles Team"
    120.             send "&2/team invite <Spieler> &8» &aLade jemanden zu deinem Team ein"
    121.        
    122.         if arg-1 is "reload": if player has permission "team.admin": execute console command "sk reload all" send "{@prefix} &2Du hast alle Skripts reloaded!" else: send "{@prefix} {@no-permission}"
    123.        
    124. on damage of a player:
    125.     if {team.in.%attacker%} = "1":
    126.         if {team.in.%victim%} = "1":
    127.             if {team.%attacker%} = {team.%victim%}:
    128.                 send "{@prefix} {@friendly-fire}" to attacker
    129.                 cancel event
    130.                
    131. on join:
    132.     if {team.in.%player%} = "1":
    133.         set the maximum health of player to 12
    134.         wait 1 tick
    135.         heal player
    136.        
    137. on damage:
    138.     loop all players:
    139.         if {team.in.%player%} = {team.in.%loop-player%}:
    140.             damage loop-player by %damage of player%
     
  5. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    So, try this:
    Code (Skript):
    1.  
    2. on damage:
    3.     victim is a player
    4.     loop all players:
    5.         if {team.in.%loop-player%} contains {team.in.%victim%}:
    6.             damage loop-player by victim's damage
    I didn't tried but i think that it will work.
     
  6. Lennart Raff

    Lennart Raff Member

    Joined:
    Sep 16, 2019
    Messages:
    3
    Likes Received:
    0
    THANKS! I will try it out
     
Thread Status:
Not open for further replies.

Share This Page

Loading...