Solved Daily Elytra Break

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

EvilSlayer

Member
Dec 23, 2020
21
1
3
21
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?
 
code_language.skript:
function getElytraBreaks(player: player) :: integer:
  if {_player} has permission "group.mvp":
    return 5
  else if {_player} has permission "group.vip":
    return 3
  return 1

on click on item frame:
  item of entity is elytra
  player's world is "world_the_end"
  if metadata "elytra_cooldown" of player > unix timestamp of now:
    metadata "elytra_breaks" of player >= getElytraBreaks(player)
    cancel event
    stop
  add 1 to "elytra_breaks"
  if metadata "elytra_breaks" of player >= getElytraBreaks(player):
    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
 
code_language.skript:
function getElytraBreaks(player: player) :: integer:
  if {_player} has permission "group.mvp":
    return 5
  else if {_player} has permission "group.vip":
    return 3
  return 1

on click on item frame:
  item of entity is elytra
  player's world is "world_the_end"
  if metadata "elytra_cooldown" of player > unix timestamp of now:
    metadata "elytra_breaks" of player >= getElytraBreaks(player)
  add 1 to "elytra_breaks"
  if metadata "elytra_breaks" of player >= getElytraBreaks(player):
    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
Thanks for answer but giving error Can u look this? Script didn't give error but not working.

Code:
function getElytraBreaks(attacker: player) :: integer:
    if {_attacker} has permission "elytra.premium":
        return 3
    else if {_attacker} has permission "elytra.uvip":
        return 2
    else:
        return 1

on damage of itemframe:
    if attacker's world is "irongard_the_end":
        if metadata {elytra_cooldownxxx} of attacker > unix timestamp of now:
            metadata {elytra_breakxxx} of attacker >= getElytraBreaks(attacker)
            cancel event
            message "&5End &8» &7You elytra break limit is &cover." to attacker
            stop
        if metadata {elytra_breakxxx} of attacker >= getElytraBreaks(attacker):
            set metadata {elytra_cooldownxxx} of attacker to unix timestamp of 30 seconds later
 
Last edited:
Thanks for answer but giving error Can u look this? Script didn't give error but not working.

Code:
function getElytraBreaks(attacker: player) :: integer:
    if {_attacker} has permission "elytra.premium":
        return 3
    else if {_attacker} has permission "elytra.uvip":
        return 2
    else:
        return 1

on damage of itemframe:
    if attacker's world is "irongard_the_end":
        if metadata {elytra_cooldownxxx} of attacker > unix timestamp of now:
            metadata {elytra_breakxxx} of attacker >= getElytraBreaks(attacker)
            cancel event
            message "&5End &8» &7You elytra break limit is &cover." to attacker
            stop
        if metadata {elytra_breakxxx} of attacker >= getElytraBreaks(attacker):
            set metadata {elytra_cooldownxxx} of attacker to unix timestamp of 30 seconds later
metadata "elytra_cooldownxxx"
not
metadata {elytra_cooldownxxx}
same for other lines
 
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
Doesn't give any error.
Code:
function getElytraBreaks(attacker: player) :: integer:
    if {_attacker} has permission "elytra.premium":
        return 3
    else if {_attacker} has permission "elytra.uvip":
        return 2
    else:
        return 1

on damage of itemframe:
    if attacker's world is "irongard_the_end":
        if metadata "elytra_cooldownxxx" of attacker > unix timestamp of now:
            metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker)
            cancel event
            message "&5End &8» &7Günlük elitra kırma hakkın &cbitti." to attacker
            stop
        if metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker):
            set metadata "elytra_cooldownxxx" of attacker to unix timestamp of 24 hours later
 
Doesn't give any error.
Code:
function getElytraBreaks(attacker: player) :: integer:
    if {_attacker} has permission "elytra.premium":
        return 3
    else if {_attacker} has permission "elytra.uvip":
        return 2
    else:
        return 1

on damage of itemframe:
    if attacker's world is "irongard_the_end":
        if metadata "elytra_cooldownxxx" of attacker > unix timestamp of now:
            metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker)
            cancel event
            message "&5End &8» &7Günlük elitra kırma hakkın &cbitti." to attacker
            stop
        if metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker):
            set metadata "elytra_cooldownxxx" of attacker to unix timestamp of 24 hours later
code_language.skript:
function getElytraBreaks(attacker: player) :: integer:
    if {_attacker} has permission "elytra.premium":
        return 3
    else if {_attacker} has permission "elytra.uvip":
        return 2
    else:
        return 1
 
on damage of itemframe:
    if attacker's world is "irongard_the_end":
        if metadata "elytra_cooldownxxx" of attacker > unix timestamp of now:
            metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker)
            cancel event
            message "&5End &8» &7Günlük elitra kırma hakkın &cbitti." to attacker
            stop
        add 1 to metadata "elytra_breakxxx" of attacker
        if metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker):
            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
 
code_language.skript:
function getElytraBreaks(attacker: player) :: integer:
    if {_attacker} has permission "elytra.premium":
        return 3
    else if {_attacker} has permission "elytra.uvip":
        return 2
    else:
        return 1
 
on damage of itemframe:
    if attacker's world is "irongard_the_end":
        if metadata "elytra_cooldownxxx" of attacker > unix timestamp of now:
            metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker)
            cancel event
            message "&5End &8» &7Günlük elitra kırma hakkın &cbitti." to attacker
            stop
        add 1 to metadata "elytra_breakxxx" of attacker
        if metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker):
            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
upload_2022-1-27_17-1-17.png
 
Code:
set metadata "elytra_breakxxx" of attacker to metadata "elytra_breakxxx" of attacker + 1
 
Code:
set metadata "elytra_breakxxx" of attacker to metadata "elytra_breakxxx" of attacker + 1
Thanks now working.
[doublepost=1643398722,1643295333][/doublepost]
code_language.skript:
function getElytraBreaks(attacker: player) :: integer:
    if {_attacker} has permission "elytra.premium":
        return 3
    else if {_attacker} has permission "elytra.uvip":
        return 2
    else:
        return 1
 
on damage of itemframe:
    if attacker's world is "irongard_the_end":
        if metadata "elytra_cooldownxxx" of attacker > unix timestamp of now:
            metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker)
            cancel event
            message "&5End &8» &7Günlük elitra kırma hakkın &cbitti." to attacker
            stop
        add 1 to metadata "elytra_breakxxx" of attacker
        if metadata "elytra_breakxxx" of attacker >= getElytraBreaks(attacker):
            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
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