Solved Every sec loop

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

MeHow

Active Member
Feb 6, 2017
140
13
18
22
Lithuania
Hello and thanks for help,
Code:
code_language.skript:
every second:
    loop all players:
        if loop-player is wearing iron helmet:
            if {wearing_helmet::%loop-player%} is false:
                set {wearing_helment::%loop-player%} to true
                broadcast "s"
        else:
            if {wearing_helmet::%loop-player%} is true:
                set {wearing_helmet::%loop-player%} to false
                broadcast "ssssss"
                loop all blocks in radius 5 of loop-player:
                    if loop-block isn't obsidian:
                        broadcast "ssss"
                        damage loop-player by 0.5 heart
                        broadcast "ss"

Skript: 2.2
Server: 1.11

Code doesnt work, debug mode too
 
What are you trying to achieve exactly? saying that it doesn't work doesn't tell me what's not working so you'll have to be a bit more specific. And you shouldn't use periodical events, less in this kind of stuff; SharpSK has an armor equip/unequip event if that's what you want.
 
I want to do that every sec it will loop all players and then check if they are wearing iron helmet ir not loop all blocks around player if loop block is obsidian stop if not damage . I tried with sharpsk with new version its doesnt work :emoji_stuck_out_tongue:
[doublepost=1505233440,1505153788][/doublepost]bump
 
I want to do that every sec it will loop all players and then check if they are wearing iron helmet ir not loop all blocks around player if loop block is obsidian stop if not damage . I tried with sharpsk with new version its doesnt work :emoji_stuck_out_tongue:
[doublepost=1505233440,1505153788][/doublepost]bump
Replace:
code_language.skript:
            if {wearing_helmet::%loop-player%} is false:
with:
code_language.skript:
            if {wearing_helmet::%loop-player%} is not set:

And
code_language.skript:
Set {wearing_helmet::%loop-player%} To false
with
code_language.skript:
Delete {wearing_helmet::%loop-player%}

This is because THE value never gets set so at THE start iT isn't false or true
 
Doesn't work, but i editted the code:
code_language.skript:
every 2 seconds:
    loop all players:
        if loop-player is wearing iron helmet:
            stop
        else:
            loop all blocks in radius 10 of loop-player:
                if loop-block is end portal frame:
                    broadcast "as"
                    stop loop
                else if loop-block is not end portal frame:
                    damage loop-player by 0.5 heart

Resultat: it broadcast and damage at the same time....
 
Doesn't work, but i editted the code:
code_language.skript:
every 2 seconds:
    loop all players:
        if loop-player is wearing iron helmet:
            stop
        else:
            loop all blocks in radius 10 of loop-player:
                if loop-block is end portal frame:
                    broadcast "as"
                    stop loop
                else if loop-block is not end portal frame:
                    damage loop-player by 0.5 heart

Resultat: it broadcast and damage at the same time....
Yeah its right. Cuz he loop blocks in 10 radius around player AT ONCE TIME... if you don't want Broadcast and damage at the time then add wait a seconds or what ever inside of the loop


maybe you wanna this way?

code_language.skript:
every 2 seconds:
    loop all players:
        if loop-player is wearing iron helmet:
            stop
        else:
            loop all blocks in radius 10 of loop-player:
                if loop-block is end portal frame:
                    set {_Found} to true
                    stop loop
            if {_found} is not set:
                damage loop-player by 0.5 heart
 
  • Like
Reactions: MeHow
Status
Not open for further replies.