Jump to content

PvP Toggle & Combat log skript


Recommended Posts

 

on damage:
	if {pvp.toggle::%uuid of victim%} is true:
		if {pvp.toggle::%uuid of attacker%} is true:
			if attacker is player:
				if victim is player:
					set {pvplog.active::%uuid of victim%} to true
					set {pvplog.timer::%uuid of victim%} to 15
					set {pvplog.player::%uuid of victim%} to player
					set {pvplog.active::%uuid of attacker%} to true
					set {pvplog.timer::%uuid of attacker%} to 15
					set {pvplog.player::%uuid of attacker%} to player
		else:
			send "&cThis player has pvp off!" to attacker
	else:
		stop

command /pvptoggle:
	cooldown: 5 seconds
	cooldown message: &cYou can only do this command every 5 seconds!
	trigger:
		if {pvplog.active::%uuid of player%} is true:
			send "&cYou can't use this command while in pvp!" to player
		else:
			if {pvp.toggle::%uuid of player%} is true:
				set {pvp.toggle::%uuid of player%} to false
				send "&aYou dissabled pvp for yourself!" to player
			if {pvp.toggle::%uuid of player%} is false:
				set {pvp.toggle::%uuid of player%} to true
				send "&aYou have enabled pvp for yourself!" to player

every second:
	loop all players:
		if {pvplog.active::%uuid of loop-value%} is true:
			if {pvplog.timer::%uuid of loop-value%} > 0:
				remove 1 from {pvplog.timer::%uuid of loop-value%}
			else if {pvplog.timer::%uuid of loop-value%} = 0:
				set {pvplog.active::%uuid of loop-value%} to false
				send "&aYou are no longer in combat!" to {pvplog.player::%uuid of loop-value%}

on quit:
	if {pvplog.active::%uuid of player%} is true:
		set {quit.loc::%uuid of player%} to location of player
		loop items in inventory of player:
			add loop-item to {_loopinventory::*}
		clear inventory of player
		drop {_loopinventory::*} at {quit.loc::%uuid of player%}
		set {pvplog.bad::%uuid of player%} to true

on join:
	if {pvplog.bad::%uuid of player%} is true:
		send "&cYou logged out while in combat and you have been killed!" to player
		set {pvplog.bad::%uuid of player%} to false

command "/pvptoggle" can only be used while not in combat, if you quit while in combat if clears your inventory and drops it at the spot you logged out.

you can only take damage if you have pvp turned on!

                                                                        Skærmbillede 2024-02-11 151140.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...