Skocz do zawartości

Pytanie

Witam mam problem ze skryptem na drużyny, mianowicie powinno po wejściu na serwer przydzielać do tej drużyny gdzie jest mniej osób a dodaje ciągle do red (błędów brak)

 

on join:
	loop all players:
		if {team::%loop-player%} = 1:
			add 1 to {_red}
		if {team::%loop-player%} = 2:
			add 1 to {_blue}
	   
		if {_red} is greater than {_blue}:
			# Dodaj gracza do niebieskich
			set {team::%player%} to 2
			execute console command "scoreboard teams join NIEBIESCY %player%"
			execute console command "/pex user %player% add permission.blue"
			stop
		else:
			set {team::%player%} to 1
			execute console command "scoreboard teams join CZERWONI %player%"
			execute console command "/pex user %player% add permission.red"
			stop
	   
on quit:
	set {team::%player%} to 0
	execute console command "scoreboard teams leave %player%"
	execute console command "/pex user %player% remove permission.blue"
	execute console command "/pex user %player% remove permission.red"
	if {team::%player%} = 1:
		remove 1 from {_red}
	if {team::%player%} = 2:
		remove 1 from {_blue}

 

Odnośnik do komentarza
https://skript.pl/temat/14954-dru%C5%BCyny/
Udostępnij na innych stronach

4 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
Jaki jest to z blue też napisz 1 albo z szansą to napisz


Możesz dokładniej wyjaśnić pierwszy sposób? I drugi mi nie odpowiada bo będzie losowac a ja chcę żeby dawało tam gdzie jest mniej

Wysłane z mojego Szajsunga

Odnośnik do komentarza
https://skript.pl/temat/14954-dru%C5%BCyny/#findComment-103259
Udostępnij na innych stronach

  • 0

Juz pomagam. Ja bym rozwiazal to w taki sposob. I jak ktos wyjdzie to bym kasowal 2 z red lub blue teamu. Taka zmienna {_red} odrazu po skonczeniu eventu znika czyli nie da sie na tym oprzec.


on script load:
    set {red} to 1
    set {blue} to 0
on join:
    if {red} is greater than {blue}:
        # Dodaj gracza do niebieskich
        set {team::%player%} to 2
        send "NIEBIESCY"
        execute console command "scoreboard teams join NIEBIESCY %player%"
        execute console command "/pex user %player% add permission.blue"
    if {blue} is greater than {red}:
        set {team::%player%} to 1
        send "CZERWONI"
        execute console command "scoreboard teams join CZERWONI %player%"
        execute console command "/pex user %player% add permission.red"
    if {team::%player%} = 1:
        add 2 to {red}
    if {team::%player%} = 2:
        add 2 to {blue}

Edytowane przez -+RoNiN+-
Odnośnik do komentarza
https://skript.pl/temat/14954-dru%C5%BCyny/#findComment-103315
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...