Jump to content

Auto broadcast


Cerial_Killer

Recommended Posts

Well, here you go 😉

# Auto broadcast skript!
# Made by Cerial

options:
	# The interval between each broadcast (in minutes)
	broadcast.interval: 3

	# The amount of auto-broadcasts you are going to have
	broadcast.amount: 5

	# Select if you want to use your own broadcast command or the built in broadcast system.
	# Set it to "none" if you don't want it to use a command.
	# If you want to use a command, then type "command: /yourcommandhere"
	# Note that it will execute commands using console, if you set a command.
	broadcast.method: "none"

# Total interval calculator
on load:
	set {totalInterval} to {@broadcast.amount} * {@broadcast.interval}
	set {bcAmount} to {@broadcast.amount}
	set {bcInterval} to {@broadcast.interval}
	set {bcMethod} to {@broadcast.method}

# Broadcast number setter
on skript load:
	set {broadcastNum} to 0

# Lines setter
command /setline <number> <string>:
	permission: abc.setline
	trigger:
		# A checker to see if the player entered a bigger number than the amount set
		if arg 1 > {bcAmount}:
			send "&c%arg 1% is bigger than the maximum amounts of broadcasts! (%{bcAmount}%)"
			stop
		
		# If the number is not bigger than the number set
		else:
			set {bcMessage::%arg 1%} to arg 2
			send "&aSet broadcast message for broadcast ##%arg 1% to %arg 2%."
			stop

# The autobroadcaster

#!------------------------------------------
#!---------DO NOT CHANGE ANYTHING-----------
#!------------FROM THIS POINT---------------
#!----UNLESS YOU KNOW WHAT YOU'RE DOING-----
#!------------------------------------------

every {totalInterval} minutes:
	# I will add 1 to the broadcast number
	add 1 to {broadcastNum}

	# I will make sure the broadcast number is not above the maximum amount
	if {broadcastNum} >= {@broadcast.amount}:
		set {broadcastNum} to 0

	# If the number is not above the number set, this code should run.
	# The code should run even when the number is set back to 0.
	if {bcMethod} contains "command: ":
		set {_bcm} to {bcMethod}
		replace all "command: " in {_bcm} with ""
		console command "%{_bcm}% %{bcMessage::%{broadcastNum}%}%"
		stop
	
	if {bcMethod} = "none":
		send "&7[&6AutoBroadcast&7] &6%{bcMessage::%{broadcastNum}%}%" to all players
		stop

 

Edited by Cerial_Killer
tags
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...