Im currently working on a gamemode for my server that me and my friends run however I have run into a little problem. I want players to right click a lime dye and get given an item from a list of random chances. for example 5% diamonds etc. However i dont want this to be overpowered so i want to add a delay to that amount of times you right click the lime dye. For example you right click the dye and get a cobblestone then right click it again and it says: you must wait five seconds before you do that again. My code has no problems when i do /sk reload however it doesn't have the delay (people can still spam click it and bypass the delay entirely along with that if they click with any other item they get sent wait five seconds to use that again (which is the part of my code from the bottom.
Heres my code. If someone could help me that would be great:
on right click:
if player's held item is lime dye named "&aGenerator":
set {Spawn::%player%} to 5
send "Wait 5 Seconds before doing that again"
chance of 40%:
add 1 cobblestone to player
chance of 5%:
add 1 dirt to player
chance of 3%:
add 1 sand to player
chance of 2%:
add 1 coal to player
chance of 1%:
add 1 iron ore to player
chance of 0.2%:
add 1 oak sapling to player
chance of 0.1%:
add 1 grass block to player
chance of 0.2%:
add 1 sugar cane to player
chance of 0.06%:
add 1 water bucket to player
chance of 0.04%:
add 1 lava bucket to player
chance of 0.08%:
add 1 diamond to player
chance of 0.02%:
add 1 netherite ingot to player
chance of 2%:
add 1 oak log to player
chance of 4%:
add 1 stick to player
chance of 1%:
add 1 wheat seeds to player
chance of 0.5%:
add 1 gold ore to player
chance of 0.01%:
add 1 wither rose to player
chance of 0.01%:
add 1 soul sand to player
chance of 0.001%:
add 1 wither skeleton skull to player
chance of 0.005%:
add 1 gunpowder to player
chance of 2%:
add 1 hay block to player
chance of 1%:
add 1 leather to player
chance of 0.5%:
add 1 bone to player
while {Spawn::%player%} is not 0:
wait a seconds
subtract 1 from {Spawn::%player%}
else if {Spawn::%player%} is not 0:
send "wait five seconds to use that again"
[doublepost=1610872094,1610872052][/doublepost]Ignore all of the chance of's just wanted to include the whole thing just in case
Heres my code. If someone could help me that would be great:
on right click:
if player's held item is lime dye named "&aGenerator":
set {Spawn::%player%} to 5
send "Wait 5 Seconds before doing that again"
chance of 40%:
add 1 cobblestone to player
chance of 5%:
add 1 dirt to player
chance of 3%:
add 1 sand to player
chance of 2%:
add 1 coal to player
chance of 1%:
add 1 iron ore to player
chance of 0.2%:
add 1 oak sapling to player
chance of 0.1%:
add 1 grass block to player
chance of 0.2%:
add 1 sugar cane to player
chance of 0.06%:
add 1 water bucket to player
chance of 0.04%:
add 1 lava bucket to player
chance of 0.08%:
add 1 diamond to player
chance of 0.02%:
add 1 netherite ingot to player
chance of 2%:
add 1 oak log to player
chance of 4%:
add 1 stick to player
chance of 1%:
add 1 wheat seeds to player
chance of 0.5%:
add 1 gold ore to player
chance of 0.01%:
add 1 wither rose to player
chance of 0.01%:
add 1 soul sand to player
chance of 0.001%:
add 1 wither skeleton skull to player
chance of 0.005%:
add 1 gunpowder to player
chance of 2%:
add 1 hay block to player
chance of 1%:
add 1 leather to player
chance of 0.5%:
add 1 bone to player
while {Spawn::%player%} is not 0:
wait a seconds
subtract 1 from {Spawn::%player%}
else if {Spawn::%player%} is not 0:
send "wait five seconds to use that again"
[doublepost=1610872094,1610872052][/doublepost]Ignore all of the chance of's just wanted to include the whole thing just in case