How do I fix this?

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

GlacialDew

Member
Apr 8, 2018
40
3
8
Norrland
I want it to where players can only place a maximum of blocks, but I cant figure out how to lay it out, this is what I have so far but it doesnt stop players from placing over the max.


code_language.skript:
on place:
    set {owner::%event-block%} to player
    if event-block is spruce wood planks:
        if {%player%.wood.placed} is equal to {%player%.max.wood}:
            cancel event
            send "&6%{%player%.wood.placed}%&7/&6%{%player%.max.wood}% &7Max Wood Reached!"
            stop
        if {%player%.wood.placed} is not equal to {%player%.max.wood}:
            set {%player%.wood.placed} to {%player%.wood.placed} + 1
            send "&6%{%player%.wood.placed}%&7/&6%{%player%.max.wood}% &7Wood Placed"
            stop
 
its because {%player%.wood.placed} has never been set, so adding 1 to it is like adding 1 to air, nothing there

so do something like
if {%player%.wood.placed} is not set:
set {%player%.wood.placed} to 0 (or 1, whichever you choose)
 
its because {%player%.wood.placed} has never been set, so adding 1 to it is like adding 1 to air, nothing there

so do something like
if {%player%.wood.placed} is not set:
set {%player%.wood.placed} to 0 (or 1, whichever you choose)
its already set to 0
 
hmmm odd....
i thought it had to be set first.
Anyways i copied your code into a test skript, added in a command to set the max wood thing, tested with 3 and it works fine.
So im not really sure what your trouble is here?
whenever i use it, it will either not stop it from placing once over the max, or it wont allow me to place anything .-.
 
code_language.skript:
on place:
    set {owner::%event-block%} to player
    if event-block is spruce wood planks:
        if {%player%.wood.placed} >= {%player%.max.wood}:
            cancel event
            send "&6%{%player%.wood.placed}%&7/&6%{%player%.max.wood}% &7Max Wood Reached!"
        else if {%player%.wood.placed} < {%player%.max.wood}:
            add 1 to {%player%.wood.placed}
            send "&6%{%player%.wood.placed}%&7/&6%{%player%.max.wood}% &7Wood Placed"
 
Status
Not open for further replies.