Solved Skript Block Issue

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

BrettPlayMC

Supporter
Jan 26, 2017
715
53
28
SkUnity Street
Skript Version: 2.2-dev23
Skript Author: Bensku?
Minecraft Version: 1.8.8
Full Code:
code_language.skript:
on rightclick on a chest:
 if player's world is "KitPvP":
  if player's gamemode is adventure:
   if "%location of clicked block%" contains "-1422" and "5" and "981":
   #if "%location of clicked chest%" contains "-1422" and "5" and "981":
    cancel the event
    broadcast "&a&lWOOHOO!"

Errors on Reload:
None

Console Errors: (if applicable)

None

Other Useful Info:
Here is a video where I demonstrate it not working:

Addons using (including versions):
Skript, SkQuery, SkStuff, skUtilities, SkAction, Skellett, skRayFall, WolvSk, Umbaska, MundoSk, WildSkript, TuSke, SharpSK
(Yes I have a problem with addons)

Troubleshooting:

Have you tried searching the docs? No
Have you tried searching the forums? Yes
What other methods have you tried to fix it? Changing the "if" checking methods around.
 
Last edited:
First, have you checked if other methods work? Like 'targeted block' instead of 'clicked block'?
And have you sent test messages? Because maybe another thing in the code doesn't work.

But, I think the best way to fix this issue, is to set the location as a variable.
It's better when you have to check this later in the code.

code_language.skript:
on right click on a chest:
 if player's world is "KitPvP":
  if player's gamemode is adventure:
   if {KitPvP::CrateLocation} is location of clicked block:
    cancel event
    message "&a&lWOOHOO!"

command /kitpvp <text>:
 permission: kitpvp.admin
 trigger:
  if arg-1 is "setcratelocation":
   if targeted block is a chest:
    set {KitPvP::CrateLocation} to location of targeted block
    message "&a&lYou've set the Crate location!"
 
or... if you wan't without Variables. then try this

code_language.skript:
on rightclick:
    set {_loc} to location of clicked block
    set {_x} to x-coord of {_loc}
    if {_x} is -1422:
        set {_z} to z-coord of {_loc}
        if {_z} is 981:
            set {_y} to y-coord of {_loc}
            if {_y} is 5:
                send "Woho"
 
or... if you wan't without Variables. then try this

code_language.skript:
on rightclick:
    set {_loc} to location of clicked block
    set {_x} to x-coord of {_loc}
    if {_x} is -1422:
        set {_z} to z-coord of {_loc}
        if {_z} is 981:
            set {_y} to y-coord of {_loc}
            if {_y} is 5:
                send "Woho"

Yeah, that's also a possible way.
 
First, have you checked if other methods work? Like 'targeted block' instead of 'clicked block'?
And have you sent test messages? Because maybe another thing in the code doesn't work.

But, I think the best way to fix this issue, is to set the location as a variable.
It's better when you have to check this later in the code.

code_language.skript:
on right click on a chest:
 if player's world is "KitPvP":
  if player's gamemode is adventure:
   if {KitPvP::CrateLocation} is location of clicked block:
    cancel event
    message "&a&lWOOHOO!"

command /kitpvp <text>:
 permission: kitpvp.admin
 trigger:
  if arg-1 is "setcratelocation":
   if targeted block is a chest:
    set {KitPvP::CrateLocation} to location of targeted block
    message "&a&lYou've set the Crate location!"
It worked!
Thank you so much! :emoji_grinning:
 
  • Like
Reactions: martinpeeters34
Status
Not open for further replies.