if player has item

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

xRyZerK

Member
Mar 31, 2020
3
0
0
27
If player has a particular item, I want it to be sold.

Code:
options:
    p: &6&lOTOSAT &8► &f
    lapislazuli: 100
    lapiscevher: 2222222
    lapisblok: 222222222
   
every 30 seconds:
    loop all players:
        if {lapislazuliac.%loop-player%} is true:
            if loop-player has 1 of lapis lazuli:
                remove all lapis lazuli from loop-player's inventory
                add {@lapislazuli} * {_itemcountlz} to the loop-player's money
 
Last edited:
If player has a particular item, I want it to be sold.

Code:
options:
    p: &6&lOTOSAT &8► &f
    lapislazuli: 100
    lapiscevher: 2222222
    lapisblok: 222222222
 
every 30 seconds:
    loop all players:
        if {lapislazuliac.%loop-player%} is true:
            if loop-player has 1 of lapis lazuli:
                remove all lapis lazuli from loop-player's inventory
                add {@lapislazuli} * {_itemcountlz} to the loop-player's money
Is this a request or a question with a code? Anyways, this should help you:

code_language.skript:
options:
    p: &6&lOTOSAT &8► &f
    lapislazuli: 100
    lapiscevher: 2222222
    lapisblok: 222222222

every 30 seconds:
    loop all players:
        if {lapislazuliac.%loop-player%} is true:
            set {_inv} to loop-player's inventory
            if {_inv} contains lapis lazuli:
                set {_lap} to amount of lapis lazuli in {_inv}
                wait a tick
                set {_lap.total} to {@lapislazuli} * {_lap}
                wait a tick
                add {_lap.total} to loop-player's balance
                remove all lapis lazuli from {_inv}
 
Last edited:
Is this a request or a question with a code? Anyways, this should help you:

code_language.skript:
options:
    p: &6&lOTOSAT &8► &f
    lapislazuli: 100
    lapiscevher: 2222222
    lapisblok: 222222222

every 30 seconds:
    loop all players:
        if {lapislazuliac.%loop-player%} is true:
            set {_inv} to loop-player's inventory
            if {_inv} contains lapis lazuli:
                set {_lap} to amount of lapis lazuli in {_inv}
                wait a tick
                set {_lap.total} to {@lapislazuli} * {_lap}
                wait a tick
                add {_lap.total} to loop-player's balance
                remove all lapis lazuli from {_inv}


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 ?
 
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 ?
I didnt try this:
code_language.skript:
options:
    p: &6&lOTOSAT &8► &f
    lapislazuli: 100
    cobb: 50
    iron ore: 150
    lapiscevher: 2222222
    lapisblok: 222222222

every 30 seconds:
    loop all players:
        if {autosell.%loop-player%} is true:
            set {_inv} to loop-player's inventory
            loop all items in the {_inv}:
                add loop-value-2 to {_inventory::*}
            if {_inventory::*} contains lapis lazuli or cobblestone or iron ore: #The items that you want.
                set {_lap} to amount of lapis lazuli in {_inv}
                set {_cobb} to amount of cobblestone in {_inv}
                set {_iron.ore} to amount of iron ore in {_inv}
                wait a tick
                set {_lap.total} to {@lapislazuli} * {_lap}
                set {_cobb.total} to {@cobb} * {_cobb}
                set {_iron.ore.total} to {@iron ore} * {_iron.ore}
                wait a tick
                set {_items.total} to {_lap.total} + {_cobb.total} + {_iron.ore.total}
                add {_items.total} to loop-player's balance
                send "&2You sold &a%{_items.total}%" to loop-player
                remove loop-value from {_inv}
 
I didnt try this:
code_language.skript:
options:
    p: &6&lOTOSAT &8► &f
    lapislazuli: 100
    cobb: 50
    iron ore: 150
    lapiscevher: 2222222
    lapisblok: 222222222

every 30 seconds:
    loop all players:
        if {autosell.%loop-player%} is true:
            set {_inv} to loop-player's inventory
            loop all items in the {_inv}:
                add loop-value-2 to {_inventory::*}
            if {_inventory::*} contains lapis lazuli or cobblestone or iron ore: #The items that you want.
                set {_lap} to amount of lapis lazuli in {_inv}
                set {_cobb} to amount of cobblestone in {_inv}
                set {_iron.ore} to amount of iron ore in {_inv}
                wait a tick
                set {_lap.total} to {@lapislazuli} * {_lap}
                set {_cobb.total} to {@cobb} * {_cobb}
                set {_iron.ore.total} to {@iron ore} * {_iron.ore}
                wait a tick
                set {_items.total} to {_lap.total} + {_cobb.total} + {_iron.ore.total}
                add {_items.total} to loop-player's balance
                send "&2You sold &a%{_items.total}%" to loop-player
                remove loop-value from {_inv}

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
[doublepost=1585788150,1585734042][/doublepost]up
 
Status
Not open for further replies.