I am trying to make a combatlog script for my server. I managed to do the combatlogging part but I wanted to make a command which you can disable/enable logging for people with the right permission and thats the part that i need help with.
Code:
on damage of player:
attacker is a player
if {combat.tag::%attacker%} is false:
send "&cYou entered combat. Don't log out for 10 seconds." to attacker
set {combat.tag::%attacker%} to true
if {combat.tag::%victim%} is false:
send "&cYou entered combat. Don't log out for 10 seconds." to victim
set {combat.tag::%victim%} to true
wait 15 seconds
set {combat.tag::%attacker%} to false
set {combat.tag::%victim%} to false
on command:
command is equal to "spawn", "warp", "tpa", "mine" or "home"
if {combat.tag::%player%} is true:
message "&cTeleporting is disabled while in combat."
cancel event
On quit:
if {combat.tag::%player%} is true:
set {tag.combat::%player%} to true
kill player
On join:
if {tag.combat::%player%} is true:
wait 2 seconds
send "&cYou logged out during combat and were killed."
set {tag.combat::%player%} to false
command /combatlog <text>:
aliases: /cbl, /cblog, /clog
usage: /combatlog [on/off]
permission: combatlog.bypass
permission message: &cYou don't have the required permission to perform that command.
trigger:
send "&aYou have not turned combatlogging %arg 1%"
if %arg 1% is equal to "on":
if {combat.tag::%player%} is true:
set {combat.tag::%player%} to false
if {tag.combat::%player%} is true:
set {tag.combat::%player%} to false
if %arg 1% is equal to "off":
stop trigger