1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

About opening a fence gate

Discussion in 'Skript' started by HKPNW-Owner, Jul 28, 2018.

Thread Status:
Not open for further replies.
  1. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    Hello,
    I'm trying to make a skript which allowed when the player walk in a radius 2 with {pay.%player's uuid%} is true.
    I've tried:

    Code (Skript):
    1. on block physics:
    2.     loop all players in radius 2 around event-block:
    3.         if {pay.%player's uuid%} is true:
    4.             event-block is open Oak Fence Gate
    5.         else:
    6.             stop
    But it's not working at all. Please help.
     
  2. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    change {pay.%player's uuid%} to {pay.%loop-player's uuid%}
     
  3. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    uhm not working tho.
    I don't know if i set {pay.%player's uuid%} and {pay.%loop-player's uuid%} is the same but it is also not working.
     
  4. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    oh .... i didnt see the title properly, opening a fence is not considered a block physics, it's just a right-click event
     
  5. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    But if i need it to open automatically?..
     
  6. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    i think you would do something like:
    set event-block to opened fence gate
     
  7. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    Not working with "opened fence gate" at all.
    [email protected]@
     
  8. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    oh sorry i meant "opened oak fence gate"
     
  9. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    no errors tho. But still not working lol...
    i'm nearly giveup lol.
     
  10. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    im not sure why,
    i just tried it and it works
    Code (Skript):
    1. command /test:
    2.     trigger:
    3.         set block at location of player to opened oak fence gate
    4.  
     
  11. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    how about if set it as radius?
     
  12. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    i guess it depends what you mean
    like a radius from the fence? And then what in the radius... the players?
    You could do
    Code (Skript):
    1. on right-click on oak fence gate:
    2.     loop all players in radius 10 around event-block:
    3.         send "test" to loop-player
     
  13. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    i mean it can automatically open when the player is in the specific radius of the gate with {pay.%loop-player's uuid%}/{pay.%player's uuid%} is true
     
  14. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    that would be hard to do, you would need an event to detect when the player is close
    there's an on any movement event, but its really quite terrible to use, because it would basically be constantly looping all players on your server
     
  15. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    get it tho. thanks :emoji_slight_smile:
    --- Double Post Merged, Jul 28, 2018, Original Post Date: Jul 28, 2018 ---
    I'm now trying like this: (but it's not working and errors appear for sure)

    Code (Skript):
    1. on right click on sign:
    2.     if {pay.%player's uuid%} is true:
    3.         set block in radius 5 of player to opened oak fence gate
     
  16. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    try this
    Code (Skript):
    1. on right click on sign:
    2.     if {pay.%player's uuid%} is true:
    3.         loop blocks in radius 5 around event-block:
    4.             if loop-block is oak fence gate:
    5.                 set loop-block to opened oak fence gate
     
  17. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    it should be working but... i don't know why it don't... (no errors)
     
  18. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    ok you're not going to like this, but in this method you can change the data value of the block, I tested this and it works

    Code (Skript):
    1. on right click on sign:
    2.     if {pay.%player's uuid%} is true:
    3.         loop blocks in radius 5 around event-block:
    4.             if loop-block is oak fence gate:
    5.                 if the data value of loop-block is 1:
    6.                     set the data value of loop-block to 5
    7.                     stop
    8.                 if the data value of loop-block is 5:
    9.                     set the data value of loop-block to 1
    10.                     stop
     
  19. H

    HKPNW-Owner Active Member

    Joined:
    Feb 2, 2017
    Messages:
    26
    Likes Received:
    0
    i'm going to give you the whole skript XD. I think it's really the problem above. It's still not working


    Code (Skript):
    1. command /pcard:
    2.     trigger:
    3.         if player's balance is greater than or equal to 5:
    4.             remove 5 from balance of player
    5.             send "&5[&a全城通&5] &a已付錢, 請盡快入閘!"
    6.             wait 5 tick
    7.             set {pay.%player's uuid%} to true
    8.             wait 20 tick
    9.             delete {pay.%player's uuid%}
    10.             send "yes"
    11.         else:
    12.             send "&5[&a全城通&5] &a&4沒有足夠&a的錢"
    13.        
    14. on right click on sign:
    15.     if {pay.%player's uuid%} is true:
    16.         loop blocks in radius 5 around event-block:
    17.             if loop-block is oak fence gate:
    18.                 if the data value of loop-block is 1:
    19.                     set the data value of loop-block to 5
    20.                     stop
    21.                 if the data value of loop-block is 5:
    22.                     set the data value of loop-block to 1
    23.                     stop
    (Some words are Chinese anyway)
     
  20. ShaneBee

    Supporter +

    Joined:
    Sep 7, 2017
    Messages:
    1,459
    Likes Received:
    96
    ah yes, its because you set {pay.%player's uuid%} to true, then 20 ticks later you delete it
     
Thread Status:
Not open for further replies.
Loading...