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 Hit event

Discussion in 'Skript' started by Simon942, Sep 23, 2018.

Tags:
Thread Status:
Not open for further replies.
  1. Simon942

    Simon942 Member

    Joined:
    Sep 22, 2018
    Messages:
    46
    Likes Received:
    1
    Hi there

    Is there an event like this? When i hit a player:
    I can't use the docs it doesn't tell me anything :emoji_frowning:

    Thanks in advance
     
  2. L0v0lup

    L0v0lup Member

    Joined:
    Feb 19, 2017
    Messages:
    23
    Likes Received:
    2
    Code (Skript):
    1. on damage:
    2.     victim is a player:
    3.         broadcast "%victim%, %attacker%"
    (You can find it in the docs) :emoji_slight_smile:
     
  3. Simon942

    Simon942 Member

    Joined:
    Sep 22, 2018
    Messages:
    46
    Likes Received:
    1
    Omg, thank you :emoji_slight_smile:!
    --- Double Post Merged, Sep 23, 2018, Original Post Date: Sep 23, 2018 ---
    Can i do so it is only players? :emoji_slight_smile:
    --- Double Post Merged, Sep 23, 2018 ---
    Who is this code not working? :emoji_slight_smile:
    Code (Skript):
    1. on damage:
    2.     victim is a player:
    3.         if player has permission "staff.gamemode":
    4.             set gamemode of player to adventure
    5.         Else:
    6.             stop
    --- Double Post Merged, Sep 23, 2018 ---
    [​IMG]
    http://prntscr.com/kxnpss
     
  4. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    310
    Likes Received:
    10
    you need to use victim or attacker on damage event, not player, even the error say that.
     
    • Agree Agree x 2
  5. Simon942

    Simon942 Member

    Joined:
    Sep 22, 2018
    Messages:
    46
    Likes Received:
    1
    Thanks :emoji_slight_smile:

    I try to make the skript so it is only staff that gets in adventure gamemode. And it is only players, for when i hit a animal in creative, my gamemode changes to Adventure. Is it possible to only do with players? :emoji_slight_smile:

    Best regartds Simon.
     
  6. Scholler

    Scholler Active Member

    Joined:
    Aug 6, 2018
    Messages:
    130
    Likes Received:
    9
    So, if I understand you, you want to do the script like this:
    Code (Skript):
    1. on damage:
    2.     victim is not a player:
    3.         if attacker has permission "staff.gamemode":
    4.             set gamemode of attacker to adventure
    5.         else:
    6.             stop
    (Code is tested and working.)
    So if you hit a mob/animal, and if you have the permission staff.gamemode your gamemode changes to adventure
    --- Double Post Merged, Sep 23, 2018, Original Post Date: Sep 23, 2018 ---
    Code (Skript):
    1. on damage:
    2.     victim is a player:
    3.         if attacker has permission "staff.gamemode":
    4.             set gamemode of attacker to adventure
    5.         else:
    6.             stop
    this is your code but "player" replaced with attacker. When you hit a player (and you have the staff.gamemode permission) your gamemode changes to adventure.
     
  7. Simon942

    Simon942 Member

    Joined:
    Sep 22, 2018
    Messages:
    46
    Likes Received:
    1
    Thank you for the information.
    I mean it should only activate when the victim is a player not a animal or mob :emoji_slight_smile:

    Best regards Simon
     
    • Agree Agree x 1
  8. Scholler

    Scholler Active Member

    Joined:
    Aug 6, 2018
    Messages:
    130
    Likes Received:
    9

    Code (Skript):
    1. on damage:
    2.     victim is a player:
    3.         if attacker has permission "staff.gamemode":
    4.             set gamemode of attacker to adventure
    5.         else:
    6.             stop
     
  9. Simon942

    Simon942 Member

    Joined:
    Sep 22, 2018
    Messages:
    46
    Likes Received:
    1
    That worked, thank you :emoji_slight_smile:
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...