Jump to content

help skript not working


Recommended Posts

hello can some one fix my skript pls i want to make it if player has diamond give item but if player doesn't have diamond don't give item

 

on inventory click:
    if index of event-slot = 11:
        cancel event
        remove 8 diamonds from player's inventory
        give player 1 dirt
    else:
        if player doesn't have 8 diamond
        send "&cYou Don't Have Enough Diamonds" to player

 

Full Skript

command /shop:
    trigger:
        set {_gui} to a new chest inventory with 3 row with name "&a&lShop"
        set slot 11 of {_gui} to iron chestplate named "&f&lIron Kit" with lore "&b&l8 Diamonds"
        open {_gui} to player

on inventory click:
    if index of event-slot = 11:
        cancel event
        remove 8 diamonds from player's inventory
        give player 1 dirt
    else:
        if player doesn't have 8 diamond
        send "&cYou Don't Have Enough Diamonds" to player

 

Edited by AZA2132
Link to comment
Share on other sites

You don't have an if statement to check if the player has 8 diamonds, try out this code

on inventory click:
	if index of event-slot = 11:
		cancel event
		if player's inventory contains 8 diamonds:
			remove 8 diamonds from player's inventory
			give player 1 dirt
		else:
			send "&cYou Don't Have Enough Diamonds" to player

 

Hello! I'm SoloStrafe!
 

Skills:

Skript (4+ years experience)

Most of the plugins on MH

Servers:

- Westmine (Developer)

- Mineport (Admin)

Minehut:

Untitled.png.395f912cec0139eaf122fc8874f57045.png

I got VIP rank on 8/1/2019 -> Current

Link to comment
Share on other sites

i have a problem with this code

 

on inventory click:
    if index of event-slot = 11:
        cancel event
        if player's inventory contains 8 nether star named "&9&lDEATH TOKEN":
            remove 8 nether star from player's inventory
            give player 1 iron sword
            give player 1 bow
            give player 16 arrow
            give player 16 cooked beef
            give player 1 iron helmet
            give player 1 iron chestplate
            give player 1 iron leggings
            give player 1 iron boots
        else:
            send "&cYou Don't Have Enough Tokens" to player

its says on inventory click thats mean on any inventory click not on the gui click when i click on slot 11 in my inventory its give me kit i just want when slot 11 on the gui clicked not my invintory slot click

Link to comment
Share on other sites

You can check the name of the player's inventory and allow the code to work only if it matches the gui's name

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...