Anti Combat Logger

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

BrettPlayMC

Supporter
Jan 26, 2017
715
53
28
SkUnity Street
Category: PvP

Suggested name: CombatLog

What I want:
I would like this java plugin in a small, efficient script file. :emoji_slight_smile:

Ideas for commands:
The ones that are in the plugin.
Ideas for permissions:
The ones that are in the plugin.
When I'd like it by: 1 week. :emoji_slight_smile:
[doublepost=1488760489,1488580457][/doublepost]bumpity!
[doublepost=1488931498][/doublepost]bump.
 
code_language.skript:
options:
    ResetCooldown: 5
   
#COMMAND
   
command /check [<player>]:
    trigger:
        if player has permission "anticombatlog.check":
            if argument-1 is set:
                set {_check} to yaml value "AntiCombatLog.Status.%uuid of arg-1%" from file "plugins/AntiCombatLog/Status.yml"
                if {_check} is "ON":
                    message "&c%arg-1% &7is in combat."
                if {_check} is "OFF":
                    message "&a%arg-1% &7isn't in combat."
                if {_check} isn't set:
                    message "&a%arg-1% &7isn't in combat."
                stop
            else:
                message "&7You need to write the player's name."
                stop
        else:
            message "&cYou are not allowed to do that."
            stop

#EVENTS

on damage:
    attacker is a player
    victim is a player
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    wait {@ResetCooldown} seconds
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
   
on teleport:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE
   
on command:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE

on quit:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        kill the player
        set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
#MESSAGE HERE
 
Last edited by a moderator:
I will load the script but I was looking through it and I didn't find anywhere where you created the folder, files, etc.
Will it still work?
 
I will load the script but I was looking through it and I didn't find anywhere where you created the folder, files, etc.
Will it still work?

It will create files only when needed.
So when a player will hit another player , it will create the yaml file.
You don't need any type of addons for that.
 
code_language.skript:
options:
    ResetCooldown: 5
 
#COMMAND
 
command /check [<player>]:
    trigger:
        if player has permission "anticombatlog.check":
            if argument-1 is set:
                set {_check} to yaml value "AntiCombatLog.Status.%uuid of arg-1%" from file "plugins/AntiCombatLog/Status.yml"
                if {_check} is "ON":
                    message "&c%arg-1% &7is in combat."
                if {_check} is "OFF":
                    message "&a%arg-1% &7isn't in combat."
                if {_check} isn't set:
                    message "&a%arg-1% &7isn't in combat."
                stop
            else:
                message "&7You need to write the player's name."
                stop
        else:
            message "&cYou are not allowed to do that."
            stop

#EVENTS

on damage:
    attacker is a player
    victim is a player
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    wait {@ResetCooldown} seconds
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
 
on teleport:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE
 
on command:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE

on quit:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        kill the player
        set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
#MESSAGE HERE
I get errors:
Java:
ERROR v0.8.8: Yaml Path: 'AntiCombatLog.Status.10cb0514-3d04-4acd-aaf3-a58aa9b18adb' doesn't exist in file '/plugins/AntiCombatLog/Status.yml' (SExprYaml.class)
Also can you put the script in hastebin?
 
I get errors:
Java:
ERROR v0.8.8: Yaml Path: 'AntiCombatLog.Status.10cb0514-3d04-4acd-aaf3-a58aa9b18adb' doesn't exist in file '/plugins/AntiCombatLog/Status.yml' (SExprYaml.class)
Also can you put the script in hastebin?
Add that
code_language.skript:
on join:
    set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
 
Add that
code_language.skript:
on join:
    set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
This is now getting spammed a lot:
code_language.skript:
17.03 17:38:04 [Server] ERROR v0.8.8: Yaml Path: 'AntiCombatLog.Status.<none>' doesn't exist in file '/plugins/AntiCombatLog/Status.yml' (SExprYaml.class)
 
This is now getting spammed a lot:
code_language.skript:
17.03 17:38:04 [Server] ERROR v0.8.8: Yaml Path: 'AntiCombatLog.Status.<none>' doesn't exist in file '/plugins/AntiCombatLog/Status.yml' (SExprYaml.class)

Try to change it with that and let me know
code_language.skript:
set yaml value "AntiCombatLog.Status.%player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
 
Try to change it with that and let me know
code_language.skript:
set yaml value "AntiCombatLog.Status.%player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
Nope:
code_language.skript:
ERROR v0.8.8: Yaml Path: 'AntiCombatLog.Status.<none>' doesn't exist in file '/plugins/AntiCombatLog/Status.yml' (SExprYaml.class)
:emoji_frowning:
 
So here is my current script:

code_language.skript:
on join:
    set yaml value "AntiCombatLog.Status.%player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"

options:
    ResetCooldown: 5
command /checkpvp [<player>]:
    trigger:
        if player has permission "anticombatlog.check":
            if argument-1 is set:
                set {_check} to yaml value "AntiCombatLog.Status.%uuid of arg-1%" from file "plugins/AntiCombatLog/Status.yml"
                if {_check} is "ON":
                    message "&c%arg-1% &7is in combat."
                if {_check} is "OFF":
                    message "&a%arg-1% &7isn't in combat."
                if {_check} isn't set:
                    message "&a%arg-1% &7isn't in combat."
                stop
            else:
                message "&7You need to write the player's name."
                stop
        else:
            message "&cYou are not allowed to do that."
            stop
#EVENTS
on damage:
    attacker is a player
    victim is a player
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    wait {@ResetCooldown} seconds
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
on teleport:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE
on command:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE

on quit:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        kill the player
        set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
But the "on command:" part doesn't make sense. Any help?
[doublepost=1492548694,1492362355][/doublepost]The following is getting spammed in my console a ton:
code_language.skript:
18.04 16:50:33 [Server] ERROR v0.8.9: Yaml Path: 'AntiCombatLog.Status.<none>' doesn't exist in file '/plugins/AntiCombatLog/Status.yml' (SExprYaml.class)
Help?
 
So here is my current script:

code_language.skript:
on join:
    set yaml value "AntiCombatLog.Status.%player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"

options:
    ResetCooldown: 5
command /checkpvp [<player>]:
    trigger:
        if player has permission "anticombatlog.check":
            if argument-1 is set:
                set {_check} to yaml value "AntiCombatLog.Status.%uuid of arg-1%" from file "plugins/AntiCombatLog/Status.yml"
                if {_check} is "ON":
                    message "&c%arg-1% &7is in combat."
                if {_check} is "OFF":
                    message "&a%arg-1% &7isn't in combat."
                if {_check} isn't set:
                    message "&a%arg-1% &7isn't in combat."
                stop
            else:
                message "&7You need to write the player's name."
                stop
        else:
            message "&cYou are not allowed to do that."
            stop
#EVENTS
on damage:
    attacker is a player
    victim is a player
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    wait {@ResetCooldown} seconds
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
on teleport:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE
on command:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE

on quit:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        kill the player
        set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
But the "on command:" part doesn't make sense. Any help?
[doublepost=1492548694,1492362355][/doublepost]The following is getting spammed in my console a ton:
code_language.skript:
18.04 16:50:33 [Server] ERROR v0.8.9: Yaml Path: 'AntiCombatLog.Status.<none>' doesn't exist in file '/plugins/AntiCombatLog/Status.yml' (SExprYaml.class)
Help?
I'm I think that is a check to see if anyone does a command it runs a check...idk why on command but...
 
I'm I think that is a check to see if anyone does a command it runs a check...idk why on command but...
I realize that but this spam is really annoying. Here is my script:

code_language.skript:
on join:
    set yaml value "AntiCombatLog.Status.%player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
command /log [<player>]:
    aliases: /combatlog, /checkpvp
    trigger:
        if player's world is "KitPvP":
            if arg-1 is set:
                if arg-1 has played before:
                    set {_check} to yaml value "AntiCombatLog.Status.%uuid of arg-1%" from file "plugins/AntiCombatLog/Status.yml"
                    if {_check} is "ON":
                        send "&8[&4LOG&8] &c%arg-1% &7is in combat."
                    if {_check} is "OFF":
                        send "&8[&4LOG&8] &c%arg-1% &7isn't in combat."
                    if {_check} isn't set:
                        send "&8[&4LOG&8] &c%arg-1% &7isn't in combat."
                else:
                    send "&8[&4LOG&8] &c%arg 1%&7 has not played before."
            else:
                set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
                if {_check} is "ON":
                    send "&8[&4LOG&8] &7You are currently in combat."
                else:
                    send "&8[&4LOG&8] &7You are currently not in combat."
        else:
            send "&8[&4CORE&8] &7Command not found."
#EVENTS
on damage:
    attacker is a player
    victim is a player
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    wait 10 seconds
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
on teleport:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
        send "&8[&4LOG&8] &7You are still in combat."
on command:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        if command is not "/checkpvp" or "/combatlog" or "/log" or "/sk" or "/tpohere" or "/tphere":
            cancel the event
            send "&8[&4LOG&8] &7You are still in &ccombat&7."

on quit:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        kill the player
        send {_combatlogger} to player's name
        set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
        loop all players:
            if loop-player's world is "KitPvP":
                send "&8[&4LOG&8] &c%{_combatlogger}% &7just logged out in combat."
 
I realize that but this spam is really annoying. Here is my script:

code_language.skript:
on join:
    set yaml value "AntiCombatLog.Status.%player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
command /log [<player>]:
    aliases: /combatlog, /checkpvp
    trigger:
        if player's world is "KitPvP":
            if arg-1 is set:
                if arg-1 has played before:
                    set {_check} to yaml value "AntiCombatLog.Status.%uuid of arg-1%" from file "plugins/AntiCombatLog/Status.yml"
                    if {_check} is "ON":
                        send "&8[&4LOG&8] &c%arg-1% &7is in combat."
                    if {_check} is "OFF":
                        send "&8[&4LOG&8] &c%arg-1% &7isn't in combat."
                    if {_check} isn't set:
                        send "&8[&4LOG&8] &c%arg-1% &7isn't in combat."
                else:
                    send "&8[&4LOG&8] &c%arg 1%&7 has not played before."
            else:
                set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
                if {_check} is "ON":
                    send "&8[&4LOG&8] &7You are currently in combat."
                else:
                    send "&8[&4LOG&8] &7You are currently not in combat."
        else:
            send "&8[&4CORE&8] &7Command not found."
#EVENTS
on damage:
    attacker is a player
    victim is a player
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    wait 10 seconds
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
on teleport:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
        send "&8[&4LOG&8] &7You are still in combat."
on command:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        if command is not "/checkpvp" or "/combatlog" or "/log" or "/sk" or "/tpohere" or "/tphere":
            cancel the event
            send "&8[&4LOG&8] &7You are still in &ccombat&7."

on quit:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        kill the player
        send {_combatlogger} to player's name
        set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
        loop all players:
            if loop-player's world is "KitPvP":
                send "&8[&4LOG&8] &c%{_combatlogger}% &7just logged out in combat."
Ooooooooooooo I think on command is for /tp or stuff...


So you could add a condition like
code_language.skript:
command is "/tp"
 
code_language.skript:
options:
    ResetCooldown: 5
 
#COMMAND
 
command /check [<player>]:
    trigger:
        if player has permission "anticombatlog.check":
            if argument-1 is set:
                set {_check} to yaml value "AntiCombatLog.Status.%uuid of arg-1%" from file "plugins/AntiCombatLog/Status.yml"
                if {_check} is "ON":
                    message "&c%arg-1% &7is in combat."
                if {_check} is "OFF":
                    message "&a%arg-1% &7isn't in combat."
                if {_check} isn't set:
                    message "&a%arg-1% &7isn't in combat."
                stop
            else:
                message "&7You need to write the player's name."
                stop
        else:
            message "&cYou are not allowed to do that."
            stop

#EVENTS

on damage:
    attacker is a player
    victim is a player
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "ON"
    wait {@ResetCooldown} seconds
    set yaml value "AntiCombatLog.Status.%uuid of attacker%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
    set yaml value "AntiCombatLog.Status.%uuid of victim%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
 
on teleport:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE
 
on command:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        cancel the event
# MESSAGE HERE

on quit:
    set {_check} to yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml"
    if {_check} is "ON":
        kill the player
        set yaml value "AntiCombatLog.Status.%uuid of player%" from file "plugins/AntiCombatLog/Status.yml" to "OFF"
#MESSAGE HERE
I really don't understand why people insist on using YAML for things like this.

edit: Also, if the server restarts while someone's combat mode is set to on with this skript, you're gonna have a real bad time
 
I really don't understand why people insist on using YAML for things like this.

edit: Also, if the server restarts while someone's combat mode is set to on with this skript, you're gonna have a real bad time
Would you mind rewriting it into a more efficient form? :emoji_stuck_out_tongue:
I was curious as to why it was using YML as well but I didn't question it and know you can do this with variables much more efficiently but I am not that advanced yet.
 
Try this
Code:
options:
    time: 15

function CombatTag(a: player, v: player):
    {_a} is not {_v}
    if {combatLog::%{_v}%} is not set:
        set {combatLog::%{_v}%} to {@time}
        set {combatLog::%{_a}%} to {@time}
        send "&2You are in combat" to {_v}
    else:
        if {combatLog::%{_a}%} is not set:
            set {combatLog::%{_a}%} to {@time}
            send "&2You are in combat" to {_a}
    set {combatLog::%{_v}%} to {@time}
    if {combatLog::%{_v}%} is greater than 1:
        loop {@time}:
            remove 1 from {combatLog::%{_a}%}
            remove 1 from {combatLog::%{_v}%}
            wait 1 second
            set actionbar of {_a} to "&2You have %{@time}% seconds left in combat"
            set actionbar of {_v} to "&2You have %{@time}% seconds left in combat"
    else:
        set actionbar of {_a} to ""
        set actionbar of {_v} to ""
        send "&2You are no longer on combat" to {_v}
        send "&2You are no longer on combat" to {_a}


not tested.