Jump to content

Max players in 1 location skript


iiFlameYT

Recommended Posts

6 hours ago, iiFlameYT said:

I'm making a practice type of server, Is it possible to skript smth like when there are 2 players in a place they get teleported to another arena? the place can only be joined by players anyway...

wdym "2 players in a place"

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Owner of Lifestealed, Labs, Encore, UNOfficially and Observed
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - 5/8/2024

[MOD] 5/8/2024 - Present

 

Link to comment
Share on other sites

On 12/8/2021 at 9:32 AM, iiFlameYT said:

I'm making a practice type of server, Is it possible to skript smth like when there are 2 players in a place they get teleported to another arena? the place can only be joined by players anyway...

I was just doing something like this. What I ended up doing is using a console executed command to create a world through multiverse, and teleport the players to this world. The players register to fight with a different command (not shown in the example).

So yes, I would say it is possible, but I think it would be much easier to allow players to use a command to join rather than standing in a place.

Code is below for reference to what I mean:

Spoiler
#example skript of walking then teleported?
on walk on emerald block:
	
	#check to see if the player is in the join world (if this is not here then a player in survival can join sumo on accident)
	if player's world is "SUMOHUB":
		
		#next line uses multiverse through the console (you need SUMOWORLD1 to already be created for this to work) and teleports the player to it
		make console execute command "/mvtp	%player% SUMOWORLD1"
		send "Teleported into a sumo match!" to player
		set {waitingForSumo::%player%} to "TRUE"
		set {playerSumoServer::%player%} to player's world

#Then maybe use a list or a loop to find all players who want to join the match.

every 5 seconds:
	#double loop to compare one player against another
	loop all players:
		loop all players:
			
			#check to see if the players are both waiting for a sumo match
			if {waitingForSumo::%loop-player-1%} = "TRUE":
				if {waitingForSumo::%loop-player-2%} = "TRUE":
					
					#tp player 2 to player 1's server
					if {playerSumoServer::%loop-player-1%} is not "NONE":
						make console execute command "/mvtp	%loop-player-2% %{playerSumoServer::%loop-player-1%}%"
						set {waitingForSumo::%loop-player-2%} to "FALSE"
						set {waitingForSumo::%loop-player-1%} to "FALSE"
					
					#tp player 1 to player 2's server
					else if {playerSumoServer::%loop-player-2%} is not "NONE":
						make console execute command "/mvtp	%loop-player-1% %{playerSumoServer::%loop-player-1%}%"
						set {waitingForSumo::%loop-player-2%} to "FALSE"
						set {waitingForSumo::%loop-player-1%} to "FALSE"

#THIS IS AN EXAMPLE
#if you want to use it, that is fine, just know that the work is not fully done for you, it will not finish up the game on it's own

 

 

Main MC account: Gam3rBoi (VIP in MH)

Alt MC account: *Gam3rBoi2147

Farcade server owner

Skripter with 6+ months experience + time learning coding concepts

Message me through the forums if you need anything!

Link to comment
Share on other sites

On 12/10/2021 at 4:17 AM, Gam3rBoi said:

I was just doing something like this. What I ended up doing is using a console executed command to create a world through multiverse, and teleport the players to this world. The players register to fight with a different command (not shown in the example).

So yes, I would say it is possible, but I think it would be much easier to allow players to use a command to join rather than standing in a place.

Code is below for reference to what I mean:

  Hide contents
#example skript of walking then teleported?
on walk on emerald block:
	
	#check to see if the player is in the join world (if this is not here then a player in survival can join sumo on accident)
	if player's world is "SUMOHUB":
		
		#next line uses multiverse through the console (you need SUMOWORLD1 to already be created for this to work) and teleports the player to it
		make console execute command "/mvtp	%player% SUMOWORLD1"
		send "Teleported into a sumo match!" to player
		set {waitingForSumo::%player%} to "TRUE"
		set {playerSumoServer::%player%} to player's world

#Then maybe use a list or a loop to find all players who want to join the match.

every 5 seconds:
	#double loop to compare one player against another
	loop all players:
		loop all players:
			
			#check to see if the players are both waiting for a sumo match
			if {waitingForSumo::%loop-player-1%} = "TRUE":
				if {waitingForSumo::%loop-player-2%} = "TRUE":
					
					#tp player 2 to player 1's server
					if {playerSumoServer::%loop-player-1%} is not "NONE":
						make console execute command "/mvtp	%loop-player-2% %{playerSumoServer::%loop-player-1%}%"
						set {waitingForSumo::%loop-player-2%} to "FALSE"
						set {waitingForSumo::%loop-player-1%} to "FALSE"
					
					#tp player 1 to player 2's server
					else if {playerSumoServer::%loop-player-2%} is not "NONE":
						make console execute command "/mvtp	%loop-player-1% %{playerSumoServer::%loop-player-1%}%"
						set {waitingForSumo::%loop-player-2%} to "FALSE"
						set {waitingForSumo::%loop-player-1%} to "FALSE"

#THIS IS AN EXAMPLE
#if you want to use it, that is fine, just know that the work is not fully done for you, it will not finish up the game on it's own

 

 

okie

 

 

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