Need help with skript periodic events

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

PancakeHat

Member
May 30, 2022
2
0
1
24
I'm trying to create a simple combat-log system for my server, but I cant seem to get it to work. I want it to send a message to the player in their action bar while they are in combat but it keeps throwing the error: "There's no player/console in a periodical event" Thanks in advance!
Code:
on join:
    set {timer} to 0
    set {combat} to false

on damage:
    attacker is a player:
        set {timer} to 10

every 1 seconds:
    if {timer} is greater than 0:
        set {combat} to true
    else:
        set {combat} to false

every 1 seconds in world "world":
    loop all players:
        if {combat.%loop-player%} is true:
            subtract 1 from {timer.%loop-player%}
            send action bar "&4You are in combat, don't log out! &4&l%{timer}% seconds remain" to %loop-player%
        else:
 
The %% is used for getting a string value and the effect you are using requires a player not a string, so try removing the %%:
Code:
send action bar "&4You are in combat, don't log out! &4&l%{timer}% seconds remain" to loop-player

NOTE:
the "send action bar" effect you are using requires skellet.
 
The %% is used for getting a string value and the effect you are using requires a player not a string, so try removing the %%:
Code:
send action bar "&4You are in combat, don't log out! &4&l%{timer}% seconds remain" to loop-player

NOTE:
the "send action bar" effect you are using requires skellet.

I have Skellet installed and I changed the skript a bit, but now it doesn't make the timer count down and doesn't send anything to the player. There are no errors given

Code:
on join:
    set {timer} to 0

on damage:
    attacker is a player:
        set {timer} to 10


every 1 seconds:
    loop all players:
        if {timer.loop-player} is greater than 0:
            subtract 1 from {timer.loop-player}
            send "&4&l%{timer.loop-player}%" to loop-player
            set action bar of loop-player to "&4You are in combat, don't log out! &4&l%{timer.loop-player}% seconds remain"
        else:
            set {timer.loop-player} to 0
            set action bar of loop-player "&aYou are not in combat"
 
You're varible {timer.loop-player} should be {timer.%loop-player%}.

When you do {timer.loop-player} the varible name is "timer.loop-player".

When you do {timer.%loop-player%} the varible name is "timer.playername"
 
Last edited:
Status
Not open for further replies.