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!

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

Solved PvP TempDisabler

Discussion in 'Requests' started by Brinnare, Nov 11, 2021.

Tags:
  1. Brinnare

    Brinnare Member

    Joined:
    Nov 2, 2021
    Messages:
    4
    Likes Received:
    0
    I want a skript that disables pvp for a certain player for a certain amount of seconds. Like the player that was mentioned will not be able to hit anyone that's what I mean, but can get hit.
    --- Double Post Merged, Nov 11, 2021, Original Post Date: Nov 11, 2021 ---
    Like a command /StopHitEventForPlayer [player] [seconds]
     
  2. Best Answer:
    Post #2 by oToghty, Nov 11, 2021
  3. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    142
    Likes Received:
    5
    Code (Text):
    1. command /disablepvp <player> [<timespan=10 seconds>]:
    2.     permission: pvp.disable
    3.     trigger:
    4.         set {pvp::disabled::%arg-1's uuid%} to arg-2 from now
    5.         send "&aPvP is now disabled for &e%arg-2%!" to arg-1
    6.         send "&aDisabled &e%arg-1%'s &aPvP for &e%arg-2%!" to player
    7.  
    8. on damage of player:
    9.     attacker is a player
    10.     if difference between now and {pvp::disabled::%victim's uuid%} >= 1 seconds:
    11.         cancel event
    12.         send "&cYou can't damage this player" to attacker
    13.     else:
    14.         delete {pvp::disabled::%victim's uuid%}
    Something like that should work
     
  4. Brinnare

    Brinnare Member

    Joined:
    Nov 2, 2021
    Messages:
    4
    Likes Received:
    0
    It's working but in reverse. It's making the arg-1 in the command unable to get hit and can hit. I want it to make the arg-1 unable to hit but is able to get hit
    --- Double Post Merged, Nov 12, 2021, Original Post Date: Nov 12, 2021 ---
    Like when I type /disablepvp Brinnare, it gives god mode to Brinnare and he can hit others
    --- Double Post Merged, Nov 12, 2021 ---
    Like when I type /disablepvp Brinnare, it gives god mode to Brinnare and he can hit others
    --- Double Post Merged, Nov 12, 2021 ---
    Thank you I fixed it by editing the code a bit:


    command /disablepvp <player> [<timespan=10 seconds>]:
    permission: pvp.disable
    trigger:
    set {pvp::disabled::%arg-1%} to arg-2 from now
    send "&aPvP is now disabled for &e%arg-2%!" to arg-1
    send "&aDisabled &e%arg-1%'s &aPvP for &e%arg-2%!" to player

    on damage of player:
    attacker is a player
    if difference between now and {pvp::disabled::%attacker%} >= 1 seconds:
    cancel event
    send "&cYou can't damage this player" to attacker
    else:
    delete {pvp::disabled::%attacker%}
     

Share This Page

Loading...