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.

if player has item

Discussion in 'Skript' started by xRyZerK, Mar 31, 2020.

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

    xRyZerK Member

    Joined:
    Mar 31, 2020
    Messages:
    3
    Likes Received:
    0
    If player has a particular item, I want it to be sold.

    Code (Text):
    1. options:
    2.     p: &6&lOTOSAT &8► &f
    3.     lapislazuli: 100
    4.     lapiscevher: 2222222
    5.     lapisblok: 222222222
    6.    
    7. every 30 seconds:
    8.     loop all players:
    9.         if {lapislazuliac.%loop-player%} is true:
    10.             if loop-player has 1 of lapis lazuli:
    11.                 remove all lapis lazuli from loop-player's inventory
    12.                 add {@lapislazuli} * {_itemcountlz} to the loop-player's money
     
    #1 xRyZerK, Mar 31, 2020
    Last edited: Mar 31, 2020
  2. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    Is this a request or a question with a code? Anyways, this should help you:

    Code (Skript):
    1.  
    2. options:
    3.     p: &6&lOTOSAT &8&f
    4.     lapislazuli: 100
    5.     lapiscevher: 2222222
    6.     lapisblok: 222222222
    7.  
    8. every 30 seconds:
    9.     loop all players:
    10.         if {lapislazuliac.%loop-player%} is true:
    11.             set {_inv} to loop-player's inventory
    12.             if {_inv} contains lapis lazuli:
    13.                 set {_lap} to amount of lapis lazuli in {_inv}
    14.                 wait a tick
    15.                 set {_lap.total} to {@lapislazuli} * {_lap}
    16.                 wait a tick
    17.                 add {_lap.total} to loop-player's balance
    18.                 remove all lapis lazuli from {_inv}
     
    #2 couger44, Mar 31, 2020
    Last edited: Mar 31, 2020
  3. xRyZerK

    xRyZerK Member

    Joined:
    Mar 31, 2020
    Messages:
    3
    Likes Received:
    0

    I want to do this for a few different items, but I want to send a single message to the players. How can I do that ?
     
  4. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    I didnt try this:
    Code (Skript):
    1.  
    2.  
    3. options:
    4.     p: &6&lOTOSAT &8&f
    5.     lapislazuli: 100
    6.     cobb: 50
    7.     iron ore: 150
    8.     lapiscevher: 2222222
    9.     lapisblok: 222222222
    10.  
    11. every 30 seconds:
    12.     loop all players:
    13.         if {autosell.%loop-player%} is true:
    14.             set {_inv} to loop-player's inventory
    15.             loop all items in the {_inv}:
    16.                 add loop-value-2 to {_inventory::*}
    17.             if {_inventory::*} contains lapis lazuli or cobblestone or iron ore: #The items that you want.
    18.                 set {_lap} to amount of lapis lazuli in {_inv}
    19.                 set {_cobb} to amount of cobblestone in {_inv}
    20.                 set {_iron.ore} to amount of iron ore in {_inv}
    21.                 wait a tick
    22.                 set {_lap.total} to {@lapislazuli} * {_lap}
    23.                 set {_cobb.total} to {@cobb} * {_cobb}
    24.                 set {_iron.ore.total} to {@iron ore} * {_iron.ore}
    25.                 wait a tick
    26.                 set {_items.total} to {_lap.total} + {_cobb.total} + {_iron.ore.total}
    27.                 add {_items.total} to loop-player's balance
    28.                 send "&2You sold &a%{_items.total}%" to loop-player
    29.                 remove loop-value from {_inv}
    30.  
     
  5. xRyZerK

    xRyZerK Member

    Joined:
    Mar 31, 2020
    Messages:
    3
    Likes Received:
    0
    I do not want all items to be sold when players open the automatic sale that can open and close the sale of certain items
    --- Double Post Merged, Apr 2, 2020, Original Post Date: Apr 1, 2020 ---
    up
     
Thread Status:
Not open for further replies.

Share This Page

Loading...