Jump to content

Toggle for random items every 30 seconds.


Columner

Recommended Posts

So I would like to get a toggle for my Skript but I haven't figured it out yet. Basically I would like a command, for example /toggleitem, to toggle the items on/off. So you get items every 30 seconds, but when you activate the command, you don't get items anymore. My Skript:

every 30 seconds:
	add 1 of (random item out of all items) to inventory of all players

 

Joined September 2019

[VIP] since June 29th, 2020

cyberryan singing never gonna give you up.png

Link to comment
Share on other sites

Just use a boolean

for example:

every 30 seconds:
    loop all players:
		if {giveitems::%loop-player%} is true:
			#do stuff

You can make a command to set {giveitems::%loop-player%} to true/false. There are other ways to do this but this one is pretty simple and easy to understand

First Joined: July 2015
VIP: January 2020
Jr.Mod: 1st April 2020
Mod: 16th July 2020

Info:

~ Skript Developer
~ Discord: @nicholxs#0001
~ Previous names: Nichxlxs, Deterno, iHaveSkills, Retrical

Link to comment
Share on other sites

  • 2 months later...

I'm gonna one-up Nichxlxs XD

every 30 seconds in world "world":
	if {randomItems} is not set:
		add 1 of (random item out of all items) to inventory of all players
command /toggle:
	permission: op
	permission message: &4Insufficient permission
	trigger:
		if {randomItems} is not set:
			message "&7Random items &cdisabled"
			set {randomItems} to false
		else:
			message "&7Random items &aenabled"
			delete {randomItems}

 

  • Like 1

» IGN: _iZ_ «

» Joined: 12/18/2016 «

» VIP: 1/13/2018 «

» Helper: 1/29/2021 «

» [<3]: 5/8/2021 «

» Skript dev «

» Discord: iZz#0420 «

I have diabetes

React to this if I was helpful, found this interesting, or you're just nice 🙂

Link to comment
Share on other sites

every 1 second:
	give (random element out of all items) to all players where [{itemsExempt::%input's uuid%} is not set]

command /command:
	trigger:
		if {itemsExept::%player's uuid%} is set:
			delete {itemsExempt::%player's uuid%} # no unnecessary memory usage
			send "&aEnabled bla bla"
		else:
			send "&cDisabled bla bla"
			set {itemsExempt::%player's uuid%} to true

this is how i'd do it

Link to comment
Share on other sites

  • 2 weeks later...
5 hours ago, CursedWarLock said:

what if i dont want it to be everyone only who does /toggle?

 

 

add a permission to the command

command /toggle:
	permission: skript.toggle
	trigger:

@MikeTheAngel requesting lock - necroposting, post was made in January.

Support  July 29, 2020 → November 3, 2020

► Helper November 3, 2020 → February 22, 2021

► Moderator February 22, 2021 → May 17, 2021

 I might not always respond to forum dms, however I am always contactable on discord (mig#0069)

Screen Shot 2020-03-20 at 5.23.33 pm.png

Link to comment
Share on other sites

  • 4 months later...
  • Tres locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...