Jump to content

Can someone help me i dont know what else i need to add or what its a skript that puts people on random teams on join


Recommended Posts

on first join:
 set {predefined::*} to 1, 2. and 3
     
 set {_gen} to random object out of {predefined::*}

  if {_gen} is =1:
   execute console command "/luckperms user %player% parent set team-1"
        
  if {_gen} is =2:
   execute console command "/luckperms user %player% parent set team-2"
        
  else::
   execute console command "/luckperms user %player% parent set team-3"   

Edited by Aidih
Link to comment
Share on other sites

7 errors damn (ez spoonfeed)

 

 


 

Quote

set {predefined::*} to 1, 2. and 3


This isn't a thing, you can set a local variable "{_var}" to a random integer between 1 and 3, like:
 

set {_predefined} to random integer between 1 and 3

Also make sure you didn't do any typos, because there was a typo in ... to 1, 2. and 3 (you used a dot instead of a comma)

 

Quote

  if {_gen} is =1:

You added "=" before the integer, did you even reload the skript? (/sk reload <file name>)

"=" | equal to
">" | greater than
"<" | less than

">=" | greater than or equal to
"<=" | less than or equal to

You did: if {_gen} is is1:
Also you didn't even set any random number to the local var {_gen}, but you did for {_predefined}


...
if {_predefined} is 1:
	...

 

 

Also you have indentation errors on:
 

Quote

execute console command "[cmd]"

In skript, you need to maintain consistent indentation, meaning you cannot indent 1 line 5 spaces, and the next 7 spaces. Usually it's recommended you use tabs, however.
A good rule of thumb is to always indent the subsequent line whenever the previous statement ends with a ":", an exception to this in command statements with items before the trigger such as "permission:" or "aliases:"
With conditional statements and loops, any code that is indented within the statement will be run as a part of the statement, other code will not run within the statement. Here's an example.

command /test:
	permission: skript.test
	trigger:
		if {example} is not set:
			broadcast "Thisdwipjorgv"
			wait 1 tick
            loop all players:
				send "Hello, %loop-player%"
		else if {example2} is true:
			broadcast "Thujioerfgtsero5tfhuigb"

 


...
	if {_predefined} = 1:
		execute console command "/luckperms user %player% parent set team-1"
...

 

 

Quote

 else::

You added 2 of ":" and else is used for stuff like "is true/false" "is set/not set"

Here's the fixed code:
 

on first join:
	set {_predefined} to random integer between 1 and 3

 	if {_predefined} = 1:
		execute console command "/luckperms user %player% parent set team-1"
        
	if {_predefined} = 2:
		execute console command "/luckperms user %player% parent set team-2"
        
	if {_predefined} = 3:
		execute console command "/luckperms user %player% parent set team-3" 

 

Also I removed " set {_gen} to random object out of {predefined::*}" because it's useless, why are you setting a variable to numbers and using another variable to set to the variable thats set to numbers (smth like that I honestly dont know what i said)

Also I might be wrong, and I don't know how to explain things properly so ya

AND YOU ARE IN THE WRONG FORUM!

Edited by sulfur
Forgot to add one more thing
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...