I made a gen skript that works fine and added that only the owner of that gen can upgrade/remove it but it doesn't work, there are no errors in the skript.
I have attached the full skript, and put the part I think is not working in the thread.
I have set the {owner} to player and then checked if the owner is set and if it's not player.
When I destroy/upgrade the gen it works fine, but when another player destroys it it doesn't stop him and let him break the gen.
I have attached the full skript, and put the part I think is not working in the thread.
I have set the {owner} to player and then checked if the owner is set and if it's not player.
When I destroy/upgrade the gen it works fine, but when another player destroys it it doesn't stop him and let him break the gen.
Code:
command /wheatgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player hay block named "&eWheat Gen"
command /pumpkingen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player pumpkin named "&6Pumpkin Gen"
command /coalgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player coal block named "&8Coal Gen"
command /irongen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player iron block named "&fIron Gen"
command /goldgen:
permission: op
permission message: "&4You are not allowed to do that!"
trigger:
give player gold block named "&6Gold Gen"
command /gencapreset [<player>]:
permission: op
permission message: "&4You can't execute this command!"
trigger:
if arg-1 is set:
if arg-1 is a player:
send "&bYou have reset %arg-1% &bgenacp" to player
set {gens::%arg-1's uuid%} to 0
command /gens:
trigger:
send "&bYou have placed %{gens::%player's uuid%}% &bgens!" to player
on place of hay block:
if name of player's held item contains "&eWheat Gen":
if {gens::%player's uuid%} < 10:
set {owner} to player
add 1 to {gens::%player's uuid%}
add location of event-block to {placed::gens::%player's uuid%::*}
send action bar "&bYou placed a wheat gen!" to player
else:
cancel event
send action bar "&cYou have reached the max gens you can place!" to player
on left click on hay block:
if {placed::gens::%player's uuid%::*} contains location of event-block:
if player is sneaking:
if {owner} is set:
if {owner} is not player:
cancel event
send action bar "&cYou are not the owner of this gen!" to player
else:
cancel event
set event-block to air
remove 1 from {gens::%player's uuid%}
remove location of event-block from {placed::gens::%player's uuid%::*}
send action bar "&cYou broke a wheat gen!" to player
give player hay block named "&eWheat Gen"
else:
cancel event
send action bar "&bTo break a gen you need to be shifting." to player
on right click on hay block:
if {placed::gens::%player's uuid%::*} contains location of event-block:
if player is sneaking:
if {owner} is set:
if {owner} is not player:
send action bar "&cYou are not the owner of this gen!" to player
else:
wait 10 ticks
set event-block to pumpkin
send action bar "&bYou upgraded a gen!" to player
Attachments
Last edited: