1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Check if player is holding a block

Discussion in 'Skript' started by Uzumaki, Apr 27, 2018.

Thread Status:
Not open for further replies.
  1. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    306
    Likes Received:
    10
    There is a way to check if player's tool is a block(not a weapon or things such as armor and other items)?

    ps.
    Code (Skript):
    1. if player's tool is a block:
    not work
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,177
    Likes Received:
    218
    Are you meaning something like this?
    Code (Skript):
    1. command /testblock:
    2.     trigger:
    3.         if player's held item is dirt:
    4.             send "Yes its dirt"
     
    • Friendly Friendly x 1
  3. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    • Friendly Friendly x 1
  4. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    306
    Likes Received:
    10
  5. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    how about elaborating on your very descriptive "not work"
     
  6. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    306
    Likes Received:
    10
    Code (Skript):
    1. command testing:
    2.     trigger:
    3.         if player's held item is block:
    4.             broadcast "ye"
    Tried with blocks and other items = nothing.


    Code (Skript):
    1.  
    2. command testing:
    3.     trigger:
    4.         if player's held item is not block:
    5.             broadcast "ye"
    6.  
    7.  
    Works with any item/block.
     
  7. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    hm thats strange. you can do it with skript mirror though
    Code (Skript):
    1. on click:
    2.     if player's tool is not air: #air counts as a block
    3.         set {_item} to player's tool
    4.         if {_item}.getType().isBlock():
    5.             send "%player's tool% is a block."
     
    • Ducky Ducky x 1
  8. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    306
    Likes Received:
    10
    thanks a lot, this works.
    --- Double Post Merged, May 30, 2018, Original Post Date: Apr 27, 2018 ---
    do you have any idea why this do not work on 1.12?, thanks
     
  9. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    it should. are there errors? what skript ver?
     
  10. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    306
    Likes Received:
    10
    version dev35b(does this also on dev27)

    error:

    Code (Skript):
    1. can't understand this condition: '{_o_o}.getType().isBlock()' (WE.sk, line 95: if {_o_o}.getType().isBlock():')
    code

    Code (Skript):
    1. set {_o_o} to player's tool
    2. if {_o_o}.getType().isBlock():
    3.     #...
     
  11. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    do you have skript mirror
     
    • Friendly Friendly x 1
  12. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    306
    Likes Received:
    10
    yes, last version
     
  13. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    i tested it and its loading fine for me i have no idea why its not working for you. are you using spigot?
     
  14. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    306
    Likes Received:
    10
  15. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    beats me sorry
     
  16. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    306
    Likes Received:
    10
    no problem, thanks
     
Thread Status:
Not open for further replies.

Share This Page

Loading...