Need help with a script

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

2High4fly

Member
Nov 1, 2021
2
0
1
24
Hi there, If I always break down the same block in this script, it is added to the {claypoints ::% uuid of player% :: break.points} and when 500 blocks are broken it is set to 0 again. Now it is like that if I remove another block in between, it is also added to it, but at 500 it is not set to 0. Why is that and how do I fix it?

Code:
on break:
    if player's tool is unbreakable glowing golden pickaxe named "&e&lCLAYPICKAXE &8» &6&l1":
        if event-block is white glazed terracotta:
            if event-world is "prisonmines":
                play sound "entity.experience_orb.pickup" at volume 100 and pitch 2 to player
                cancel event
                add 3 to {claypoints::%uuid of player%::break.points}
                send action bar "{@levelprefix}&e%{claypoints::%uuid of player%::break.points}%&8/&e500" to player
            if {claypoints::%uuid of player%::break.points} is 500:
                set {claypoints::%uuid of player%::break.points} to 0
                add 1 to {claypoints::%uuid of player%::level.player}
                play sound "ENTITY.PLAYER.LEVELUP" at volume 100 and pitch 0 to player
                send "{@prefix}Level&8: &e%{claypoints::%uuid of player%::level.player}%" to player
            cancel event
            add 3 to {points::%uuid of player%::punkte}
            set event-block to terracotta
            wait 3 seconds
            set event-block to white terracotta
            wait 3 seconds
            set event-block to white glazed terracotta
         
         
on break:
    if player's tool is unbreakable glowing golden pickaxe named "&e&lCLAYPICKAXE &8» &6&l1":
        if event-block is light gray glazed terracotta:
            if event-world is "prisonmines":
                play sound "entity.experience_orb.pickup" at volume 100 and pitch 2 to player
                cancel event
                add 3 to {claypoints::%uuid of player%::break.points}
                send action bar "{@levelprefix}&e%{claypoints::%uuid of player%::break.points}%&8/&e500" to player
            if {claypoints::%uuid of player%::break.points} is 500:
                set {claypoints::%uuid of player%::break.points} to 0
                add 1 to {claypoints::%uuid of player%::level.player}
                play sound "ENTITY.PLAYER.LEVELUP" at volume 100 and pitch 0 to player
                send "{@prefix}Level&8: &e%{claypoints::%uuid of player%::level.player}%" to player
            cancel event
            add 3 to {points::%uuid of player%::punkte}
            set event-block to terracotta
            wait 3 seconds
            set event-block to light gray terracotta
            wait 3 seconds
            set event-block to light gray glazed terracotta

I add: If I set the counter to 0 using the forcereset command and then reduce it to 500, it works again.
 
Hello!

This is probably because 3 is not a factor of 500. 500 / 3 is 166.67.
Make it 501 because 3 is a factor of 501. (167)

(You can also use a different number that is a factor of 3, like 3, 6, 9, 12, 15, and so on.)

if this doesn't help, let me know!

LilyBaka
 
Hi there, If I always break down the same block in this script, it is added to the {claypoints ::% uuid of player% :: break.points} and when 500 blocks are broken it is set to 0 again. Now it is like that if I remove another block in between, it is also added to it, but at 500 it is not set to 0. Why is that and how do I fix it?

Code:
on break:
    if player's tool is unbreakable glowing golden pickaxe named "&e&lCLAYPICKAXE &8» &6&l1":
        if event-block is white glazed terracotta:
            if event-world is "prisonmines":
                play sound "entity.experience_orb.pickup" at volume 100 and pitch 2 to player
                cancel event
                add 3 to {claypoints::%uuid of player%::break.points}
                send action bar "{@levelprefix}&e%{claypoints::%uuid of player%::break.points}%&8/&e500" to player
            if {claypoints::%uuid of player%::break.points} is 500:
                set {claypoints::%uuid of player%::break.points} to 0
                add 1 to {claypoints::%uuid of player%::level.player}
                play sound "ENTITY.PLAYER.LEVELUP" at volume 100 and pitch 0 to player
                send "{@prefix}Level&8: &e%{claypoints::%uuid of player%::level.player}%" to player
            cancel event
            add 3 to {points::%uuid of player%::punkte}
            set event-block to terracotta
            wait 3 seconds
            set event-block to white terracotta
            wait 3 seconds
            set event-block to white glazed terracotta
        
        
on break:
    if player's tool is unbreakable glowing golden pickaxe named "&e&lCLAYPICKAXE &8» &6&l1":
        if event-block is light gray glazed terracotta:
            if event-world is "prisonmines":
                play sound "entity.experience_orb.pickup" at volume 100 and pitch 2 to player
                cancel event
                add 3 to {claypoints::%uuid of player%::break.points}
                send action bar "{@levelprefix}&e%{claypoints::%uuid of player%::break.points}%&8/&e500" to player
            if {claypoints::%uuid of player%::break.points} is 500:
                set {claypoints::%uuid of player%::break.points} to 0
                add 1 to {claypoints::%uuid of player%::level.player}
                play sound "ENTITY.PLAYER.LEVELUP" at volume 100 and pitch 0 to player
                send "{@prefix}Level&8: &e%{claypoints::%uuid of player%::level.player}%" to player
            cancel event
            add 3 to {points::%uuid of player%::punkte}
            set event-block to terracotta
            wait 3 seconds
            set event-block to light gray terracotta
            wait 3 seconds
            set event-block to light gray glazed terracotta

I add: If I set the counter to 0 using the forcereset command and then reduce it to 500, it works again.

try using "rounded down"

Code:
if {claypoints::%uuid of player%::break.points} is rounded down 500:
 
Hi there, If I always break down the same block in this script, it is added to the {claypoints ::% uuid of player% :: break.points} and when 500 blocks are broken it is set to 0 again. Now it is like that if I remove another block in between, it is also added to it, but at 500 it is not set to 0. Why is that and how do I fix it?

Code:
on break:
    if player's tool is unbreakable glowing golden pickaxe named "&e&lCLAYPICKAXE &8» &6&l1":
        if event-block is white glazed terracotta:
            if event-world is "prisonmines":
                play sound "entity.experience_orb.pickup" at volume 100 and pitch 2 to player
                cancel event
                add 3 to {claypoints::%uuid of player%::break.points}
                send action bar "{@levelprefix}&e%{claypoints::%uuid of player%::break.points}%&8/&e500" to player
            if {claypoints::%uuid of player%::break.points} is 500:
                set {claypoints::%uuid of player%::break.points} to 0
                add 1 to {claypoints::%uuid of player%::level.player}
                play sound "ENTITY.PLAYER.LEVELUP" at volume 100 and pitch 0 to player
                send "{@prefix}Level&8: &e%{claypoints::%uuid of player%::level.player}%" to player
            cancel event
            add 3 to {points::%uuid of player%::punkte}
            set event-block to terracotta
            wait 3 seconds
            set event-block to white terracotta
            wait 3 seconds
            set event-block to white glazed terracotta
        
        
on break:
    if player's tool is unbreakable glowing golden pickaxe named "&e&lCLAYPICKAXE &8» &6&l1":
        if event-block is light gray glazed terracotta:
            if event-world is "prisonmines":
                play sound "entity.experience_orb.pickup" at volume 100 and pitch 2 to player
                cancel event
                add 3 to {claypoints::%uuid of player%::break.points}
                send action bar "{@levelprefix}&e%{claypoints::%uuid of player%::break.points}%&8/&e500" to player
            if {claypoints::%uuid of player%::break.points} is 500:
                set {claypoints::%uuid of player%::break.points} to 0
                add 1 to {claypoints::%uuid of player%::level.player}
                play sound "ENTITY.PLAYER.LEVELUP" at volume 100 and pitch 0 to player
                send "{@prefix}Level&8: &e%{claypoints::%uuid of player%::level.player}%" to player
            cancel event
            add 3 to {points::%uuid of player%::punkte}
            set event-block to terracotta
            wait 3 seconds
            set event-block to light gray terracotta
            wait 3 seconds
            set event-block to light gray glazed terracotta

I add: If I set the counter to 0 using the forcereset command and then reduce it to 500, it works again.
just check if the value is greater than or equal to 500 rather than just equal to
shortcut: >=
 
Status
Not open for further replies.