I need help with my code!

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

AlixPlayz

Member
May 28, 2019
4
0
1
23
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
 
Code:
on damage of player:
    if 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
            wait 15 seconds
        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
        if {combat.tag::%attacker%} is not set:
            send "&cYou entered combat. Don't log out for 10 seconds." to attacker
            set {combat.tag::%attacker%} to true
        if {combat.tag::%victim%} is not set:
            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:
    if command contains "spawn", "home", "warp", "tpa" or "mine":
        if {combat.tag::%player%} is true:
            cancel event
            send "&cTeleporting is disabled while in combat."
on quit:
    if {combat.tag::%player%} is true:
        set {tag.combat::%player%} to true
        set {combat.tag::%player%} to false
on join:
    if {tag.combat::%player%} is true:
        wait 3 seconds
        kill player
        send "&cYou logged out during combat and were killed."
        set {tag.combat::%player%} to false
I think the command is right, but if its not, let me know. Glad i could help :emoji_slight_smile:
 
Status
Not open for further replies.