Jump to content

What is wrong with this skript?


B00B5

Recommended Posts

command /toggleitems:
	description: Toggle Random Items To The Sender!
	cooldown: 30 seconds
	cooldown message: &cYou Need To Wait &4&l%remaining time% &cTo Use This Command Again!
	cooldown bypass: toggleitems.nocooldown

	trigger:
		toggle {%player%.randomitems::*}


if {%player%.randomitems::*} is true:
	trigger:
		every 10 seconds:
			loop all players:
				if loop-player doesn't have space for any items:
					send "&cYou Don't Have Any Inventory Space Left For Random Items!" to player
				else:
					add 1 of (random item out of all items) to inventory of all players

There is 1 error.

How should I fix this?
 

Link to comment
Share on other sites

Hey there.

1. You have an if condition which is not fired by anything, meaning it doesn't make sense. It should be in something, such as event, command, loop, etc.

2. You have a timed loop inside of a condition, which again doesn't make sense.

3. You seem to be struggling a lot with this. From what I see, you are trying to make a skript which gives player random items.

 

Check this:

# This is the command to toggle random items.
command /toggleitems:
    trigger:
        # This if condition will check if random items is enabled for the player.
        # If it's not, then the player will be added to the variable.
        if {randomitems::*} contains player:
            # Remove player if the player is already in the variable.
            remove player's uuid from {randomitems::*}
            # A message to notify.
            send "You'll no longer recieve random items."
            stop
        # Add player to the variable of random items.
        add player's uuid to {randomitems::*}
        # A message to notify
        send "You'll now recieve random items."

# This is the 10 seconds loop where it will check and give players random items.
every 10 seconds:
    # Looping all the players in that variable
    loop {randomitems::*}:
        # Set {_p} as temp variable to get the player
        set {_p} to loop-value parsed as offline player
        # Check if player is online, and then give them a random item if they are.
        if {_p} is online:
            give {_p} random element out of all items

I've tried my best to break down each part of the code. Feel free to ask any other problem you face/don't understand.

 

Note to the ones who think I spoon-fed them

Sometimes, spoon-feeding is the only way a person could learn, especially with something like Skript, where there is not much information available on doing things.

Edited by CoolProgrammer

Hello there! If you're reading this, hope you're having a wonderful day!

 

Feel free to contact me via Discord (CoolProgrammer#1920) for any help.

My DMs are always open for help.

You can also message via. forum messages for help.

1604908226_ScreenShot2021-01-28at10_32_28AM.png.2646ad6be239a9d0756a99e8e15602ab.png

Also, don't hesitate to leave a like on my post if I helped you in any way.

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