Request PVP Toggle

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

Spinydude

Member
Oct 25, 2021
1
0
1
40
I've seen a few pvp toggle skripts for admins to turn it on and off for all players. But I've been trying to find one which individual players can toggle it on off for themselves, does anyone have a skript for this or if its not to much trouble to make one?
 
I've seen a few pvp toggle skripts for admins to turn it on and off for all players. But I've been trying to find one which individual players can toggle it on off for themselves, does anyone have a skript for this or if its not to much trouble to make one?
It was pretty simple to make, but it doesnt check if a player is in combat when they run the command. Players require the permission sk.pvp to toggle.

Code:
command /combat:
  permission: sk.pvp
  trigger:
    if {combat%player%} is not false:
      set {combat%player%} to false
      send "&aYou are no longer able to fight" to player
    if {combat%player%} is false:
      set {combat%player%} to true
      send "&aYou are no now able to fight" to player

on damage of player:
  if {combat%victim%} is false:
    send "&4This player has combat off" to attacker
    cancel event
  if {combat%attacker%} is false:
    cancel event
    send "&4You can not attack while combat is off"
 
I don't want to necropost but I'm just saying instead of using %player% use %uuid of player% so that if the player changes their username, PVP will still be disabled for that player.