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 our 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 Prevent drop of item

Discussion in 'Skript' started by iAngry, Jul 12, 2018 at 1:56 AM.

  1. iAngry

    iAngry Member

    Joined:
    Thursday
    Messages:
    3
    Likes Received:
    1
    I'm trying to prevent players from dropping on the floor and storing their spawned item (/i stone) in chests. I've tried different ways to prevent it but I can't find a way.
    This is what I have now.

    Code (Skript):
    1. command /i stone:
    2.     permission: spawn.item
    3.     permission message: &dPrincess &6King &4Empress Emperor &bHave access to /item
    4.     aliases: /item stone
    5.     trigger:
    6.         message "&6Giving &c64 &6of &cstone"
    7.         give player 64 stone named "Stone" with lore "&6Spawned by &c%player%"
    8.  
    9.      
    10.  
    11.      
    12.      
    13.  


     
  2. Best Answer:
    Post #3 by Aidanete, Jul 12, 2018 at 12:55 PM
  3. PatoFrango

    PatoFrango Well-Known Member

    Joined:
    Jul 12, 2017
    Messages:
    69
    Likes Received:
    3
    Code (Skript):
    1. on drop:
    2.     line 1 of lore of event-item is “lorehere”
    3.     cancel event
    Code (Skript):
    1. on inventory click:
    2.     line 1 of lore of clicked slot is “lorehere”
    3.     cancel event
     
  4. Aidanete

    Aidanete Well-Known Member

    Joined:
    Apr 11, 2017
    Messages:
    51
    Likes Received:
    3
    This is what I would do:
    Code (Skript):
    1. on drop:
    2.     event-item is a stone named "stone":
    3.         line 1 of lore of event-item is "&6Spawned by &c%player%":
    4.             cancel event
    For the inventory, as I'm still a little noob and I never did that, I think PatoFrango code for that will work well. [His post above this you're reading now]
     
  5. iAngry

    iAngry Member

    Joined:
    Thursday
    Messages:
    3
    Likes Received:
    1
    Thank you for the help but it gives me errors
    Code (Skript):
    1. command /i stone:
    2.     permission: spawn.item
    3.     permission message: "&dPrincess &6King &4Empress Emperor &bHave access to /item"
    4.     aliases: /item stone
    5.     trigger:
    6.         message "&6Giving &c64 &6of &cstone"
    7.         give player 64 stone named "&rStone" with lore "&6Spawned Item"
    8. on inventory click:
    9.     line 1 of lore of clicked slot is “&6Spawned Item”
    10.     cancel event
    11. on drop:
    12.     line 1 of lore of event-item is “&6Spawned Item”
    13.     cancel event
    14.  
    It gives me the error
    Code (Skript):
    1. [10:44:28 ERROR]: Can't compare a text with '“&6Spawned Item”' (give.sk, line 9: line 1 of lore of clicked slot is “&6Spawned Item”')
    2. [10:44:28 ERROR]: Can't compare a text with '“&6Spawned Item”' (give.sk, line 12: line 1 of lore of event-item is “&6Spawned Item”')
    --- Double Post Merged, Jul 13, 2018 at 8:05 AM, Original Post Date: Jul 13, 2018 at 1:45 AM ---
    Nevermind. I fixed it, thank you for helping.
    This fixed it.
    Code (Skript):
    1. on drop:
    2.     if event-item is Stone named "&rStone" with lore "&6Spawned By &c%player%":
    3.         cancel event
    4.         wait 3 ticks
    5.         send "&6You can't drop spawned items"
     
    • Like Like x 1
  6. Mr_Simba

    Mr_Simba King of the Pridelands
    Moderator Supporter

    Joined:
    Dec 9, 2016
    Messages:
    243
    Likes Received:
    45
    Medals:
    The wait there is pointless, there's no need to randomly wait before sending the message.
     
    • Funny Funny x 1
  7. iAngry

    iAngry Member

    Joined:
    Thursday
    Messages:
    3
    Likes Received:
    1
    I just felt like adding it there
     
Loading...