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!

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

Solved Daily Elytra Break

Discussion in 'Requests' started by EvilSlayer, Jan 25, 2022.

  1. EvilSlayer

    EvilSlayer Member

    Joined:
    Dec 23, 2020
    Messages:
    21
    Likes Received:
    1
    Hello sorry for bad english, I have something in mind. In the End world, can we block Left Click and Right Click events for Elytra and Item Frame, giving daily elytra breaking right? For example, VIPs have the 2 break elytra permission per day. Players have the 1 break elytra permission. So the first one to the End won't be able to access all the elytras. That's the idea in my mind. Can you help me?

     
  2. Best Answer:
    Post #8 by Tenfont, Jan 27, 2022
  3. Tenfont

    Tenfont Member

    Joined:
    Mar 28, 2021
    Messages:
    24
    Likes Received:
    2
    Code (Skript):
    1. function getElytraBreaks(player: player) :: integer:
    2.   if {_player} has permission "group.mvp":
    3.     return 5
    4.   else if {_player} has permission "group.vip":
    5.     return 3
    6.   return 1
    7.  
    8. on click on item frame:
    9.   item of entity is elytra
    10.   player's world is "world_the_end"
    11.   if metadata "elytra_cooldown" of player > unix timestamp of now:
    12.     metadata "elytra_breaks" of player >= getElytraBreaks(player)
    13.     cancel event
    14.     stop
    15.   add 1 to "elytra_breaks"
    16.   if metadata "elytra_breaks" of player >= getElytraBreaks(player):
    17.     set metadata "elytra_cooldown" of player to unix timestamp of 24 hours later
    Here is some code, modify it to your liking. Not tested so it may have some slight issues, cannot confirm
     
  4. EvilSlayer

    EvilSlayer Member

    Joined:
    Dec 23, 2020
    Messages:
    21
    Likes Received:
    1
    Thanks for answer but giving error Can u look this? Script didn't give error but not working.

    Code (Text):
    1.  
    2. function getElytraBreaks(attacker: player) :: integer:
    3.     if {_attacker} has permission "elytra.premium":
    4.         return 3
    5.     else if {_attacker} has permission "elytra.uvip":
    6.         return 2
    7.     else:
    8.         return 1
    9.  
    10. on damage of itemframe:
    11.     if attacker's world is "irongard_the_end":
    12.         if metadata {elytra_cooldownxxx} of attacker > unix timestamp of now:
    13.             metadata {elytra_breakxxx} of attacker >= getElytraBreaks(attacker)
    14.             cancel event
    15.             message "&5End &8» &7You elytra break limit is &cover." to attacker
    16.             stop
    17.         if metadata {elytra_breakxxx} of attacker >= getElytraBreaks(attacker):
    18.             set metadata {elytra_cooldownxxx} of attacker to unix timestamp of 30 seconds later
    19.    
     
    #3 EvilSlayer, Jan 25, 2022
    Last edited: Jan 25, 2022
  5. Tenfont

    Tenfont Member

    Joined:
    Mar 28, 2021
    Messages:
    24
    Likes Received:
    2
    metadata "elytra_cooldownxxx"
    not
    metadata {elytra_cooldownxxx}
    same for other lines
     
  6. EvilSlayer

    EvilSlayer Member

    Joined:
    Dec 23, 2020
    Messages:
    21
    Likes Received:
    1
    Still not working
     
  7. Tenfont

    Tenfont Member

    Joined:
    Mar 28, 2021
    Messages:
    24
    Likes Received:
    2
    pls elaborate, is there any errors? resend the code you're using currently and also try debugging the code yourself to check for any possible errors
     
  8. EvilSlayer

    EvilSlayer Member

    Joined:
    Dec 23, 2020
    Messages:
    21
    Likes Received:
    1
    Doesn't give any error.
    Code (Text):
    1. function getElytraBreaks(attacker: player) :: integer:
    2.     if {_attacker} has permission "elytra.premium":
    3.         return 3
    4.     else if {_attacker} has permission "elytra.uvip":
    5.         return 2
    6.     else:
    7.         return 1
    8.  
    9. on damage of itemframe:
    10.     if attacker's world is "irongard_the_end":
    11.         if metadata "elytra_cooldownxxx" of attacker > unix timestamp of now:
    12.             metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker)
    13.             cancel event
    14.             message "&5End &8» &7Günlük elitra kırma hakkın &cbitti." to attacker
    15.             stop
    16.         if metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker):
    17.             set metadata "elytra_cooldownxxx" of attacker to unix timestamp of 24 hours later
     
  9. Tenfont

    Tenfont Member

    Joined:
    Mar 28, 2021
    Messages:
    24
    Likes Received:
    2
    Code (Skript):
    1. function getElytraBreaks(attacker: player) :: integer:
    2.     if {_attacker} has permission "elytra.premium":
    3.         return 3
    4.     else if {_attacker} has permission "elytra.uvip":
    5.         return 2
    6.     else:
    7.         return 1
    8.  
    9. on damage of itemframe:
    10.     if attacker's world is "irongard_the_end":
    11.         if metadata "elytra_cooldownxxx" of attacker > unix timestamp of now:
    12.             metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker)
    13.             cancel event
    14.             message "&5End &8» &7Günlük elitra kırma hakkın &cbitti." to attacker
    15.             stop
    16.         add 1 to metadata "elytra_breakxxx" of attacker
    17.         if metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker):
    18.             set metadata "elytra_cooldownxxx" of attacker to unix timestamp of 24 hours later
    Found the issue, this should work if you haven't fixed it already
     
  10. EvilSlayer

    EvilSlayer Member

    Joined:
    Dec 23, 2020
    Messages:
    21
    Likes Received:
    1
    upload_2022-1-27_17-1-17.png
     
  11. Sorbon

    VIP Supporter

    Joined:
    Jul 8, 2020
    Messages:
    7
    Likes Received:
    5
    Code (Text):
    1. set metadata "elytra_breakxxx" of attacker to metadata "elytra_breakxxx" of attacker + 1
     
  12. EvilSlayer

    EvilSlayer Member

    Joined:
    Dec 23, 2020
    Messages:
    21
    Likes Received:
    1
    Thanks now working.
    --- Double Post Merged, Jan 28, 2022, Original Post Date: Jan 27, 2022 ---
    Tenfont can I ask a one question? How can I prevent the block behind the item frame from breaking.
    Because If players break block behind the item frame. Doesnt add "elytra_breakxxx" metadata
     

Share This Page

Loading...