Solved Hit event

  • 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!

  • 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.

Simon942

Member
Sep 22, 2018
46
1
0
21
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
 
code_language.skript:
on damage:
    victim is a player:
        broadcast "%victim%, %attacker%"
(You can find it in the docs) :emoji_slight_smile:
 
Omg, thank you :emoji_slight_smile:!
[doublepost=1537697183,1537697017][/doublepost]Can i do so it is only players? :emoji_slight_smile:
[doublepost=1537697482][/doublepost]Who is this code not working? :emoji_slight_smile:
code_language.skript:
on damage:
    victim is a player:
        if player has permission "staff.gamemode":
            set gamemode of player to adventure
        Else:
            stop
[doublepost=1537697546][/doublepost]
kxnpss

http://prntscr.com/kxnpss
 
you need to use victim or attacker on damage event, not player, even the error say that.
 
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.
 
So, if I understand you, you want to do the script like this:
code_language.skript:
on damage:
    victim is not a player:
        if attacker has permission "staff.gamemode":
            set gamemode of attacker to adventure
        else:
            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
[doublepost=1537726392,1537726211][/doublepost]
Is it possible to only do with players?
code_language.skript:
on damage:
    victim is a player:
        if attacker has permission "staff.gamemode":
            set gamemode of attacker to adventure
        else:
            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.
 
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
 
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


code_language.skript:
on damage:
    victim is a player:
        if attacker has permission "staff.gamemode":
            set gamemode of attacker to adventure
        else:
            stop
 
Status
Not open for further replies.