Jump to content

RandomItem X second


Sorbon

Recommended Posts

RandomItem
Β 

Plugins needed:
Skript
SkRayFall


Description:
It gives everyone on the server a random item every X seconds.
The time, boss bar and black list can be edited within the skript, just open it with a regular text editor.

Features:
Timer can be changed
BossBar name, color can be changed
Black list for removing items that you do not want to give to people.
toggle


If there are any suggestions or bugs, contact me if there are any discrepancies: Sorbon#1337

CODE:

#---------------------------------------< Skript made by Sorbon >---------------------------------#
options:
	time: 20 # 5, 10, 15, 20... are the best times, :D
	
	
	bossbar: True # True or False # needs restart
	bossbarColor: green
	BossBarName: &aRandom Item in: &7[&c%{_timer}%&7]    #--->  %{_timer}% is the Timer
	
	#------------------------------------------------------------------------#	
      # THe Blacklist, everthing here wont be given to the player! 
      # ps: remove the items here, if you want to give it to the player xD
      #------------------------------------------------------------------------#
	Blacklist: bedrock, command block and barrier and stone
	
#------------------------------------------------------------------------------------------------#
	      # Do not edit the code below without knowing what you're doing
on load:
	set {_timer} to 0
	create bossbar titled "{@BossBarName}" and id "randomdrop" for all players with progress 100 with colors {@bossbarColor} if "{@bossbar}" = "True"
	
on join:
	add bossbar "randomdrop" for player if "{@bossbar}" = "True"
	
command /toggle:
	trigger:
		if {toggle::%player%} is set:
			delete {toggle::%player%}
			send "You are getting Items now!"
		else:
			set {toggle::%player%} to true
			send "You don't get any Items now :c"
	
command /random [<string>]:
	trigger:
		if player has permission "random.admin":
			if arg-1 is "Pause","Break" or "stop":
				set {break} to true
				send "&cYou stopped the Countdown"
			if arg-1 is "continue","unstop" or "start":
				send "&cYou started the countdown"
				delete {break}
			if arg-1 is not set:
				send "&7------<&aRandomItem by Sorbon&7>------"
				send "&7-> &aUse &c/random Pause &a| &cStop  &ato stop the Countdown!"
				send "&7-> &aUse &c/random Continue &a| &cStart &ato start the Countdown!"
		else:
			send "&7------<&aRandomItem by Sorbon&7>------"
			send "&7-> &cYou don't have the permissions to use this command!"
			
			
			
Every {@time} seconds:
	set bossbar "randomdrop" value to 100 if "{@bossbar}" = "True"
	loop 100 times:
		if {break} is set:
			set {_timer} to "Paused"
			set bossbar "randomdrop" title to "{@BossBarName}" if "{@bossbar}" = "True"
			set bossbar "randomdrop" value to 100 if "{@bossbar}" = "True"
			stop
		set {_s} to {@time}/100
		wait ("%{_s}% seconds" parsed as timespan)
		set bossbar "randomdrop" value to (value of bossbar "randomdrop" - 1) if "{@bossbar}" = "True"
		set {_timer} to ceil({_s} * value of bossbar "randomdrop") if "{@bossbar}" = "True"
		set bossbar "randomdrop" title to "{@BossBarName}" if "{@bossbar}" = "True"
	loop all players:
		while {_bool} is not true:
			set {_item} to random element out of all items
			set {_bool} to true if {@Blacklist} does not contain {_item}
			wait 1 tick
		give loop-player {_item} if {toggle::%loop-player%} is not set
		

Β 

RandomItem V 1.2.sk

Edited by Sorbon
Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

Cool but, when you do theΒ if player has permission:Β you could just doΒ 
Β 

command /random [<string>]:
	permission: &6LINE ONE%nl%&7LINE TWO
	trigger:
    	# the rest of the code

And also what syntax highlighting do you use for skript?

ign:

zlby_btw

discord:

zlby_btw#1349

join date:

Dec 2019

Β 

zlby_btwΒ ||Β 19 DecΒ 2019

[ESCAPED] zlby_btwΒ ||Β 26 AugΒ 2020

zlby_btwΒ ||Β 31 AugΒ 2020

Β 

Β 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 3 months later...

Topic Locked. πŸ”’

Please don't reply on month-old inactive threads. (necro-posting).Β 

πš„πš—πšπš›πšŽπšŠπšπšŽπš

π”»π•šπ•€π•”π• π•£π••: @π•Œπ•Ÿπ•₯𝕣𝕖𝕒π•₯𝕖𝕕#πŸ˜πŸ˜πŸ˜πŸ™

News & UpdatesΒ β€’Β RulesΒ β€’Β Helper Application

ReportsΒ β€’Β Appeals

πš‚πšπšŠπšπš πš˜πš— π™Όπš’πš—πšŽπš‘πšžπš πšœπš’πš—πšŒπšŽ π™Ήπšžπš—πšŽ πŸΉπŸΆπšπš‘, 𝟸𝟢𝟸𝟢

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
Γ—
Γ—
  • Create New...