Skocz do zawartości
  • 0

Pisanie na czacie


gnomq

Pytanie

Rekomendowane odpowiedzi

  • 0
on chat:
	if {cooldownMsg::%player%} is not set:
		set {cooldownMsg::%player%} to 0
	if unix timestamp of now - {cooldownMsg::%player%} < 5:
		cancel event
		send "odczekaj jeszcze %(unix timestamp of now - {cooldownMsg::%player%})% sekund"
		stop
	if {lastSender} is player:
		if unix timestamp of now - {lastMessage::%player%} < 5:
			set {cooldownMsg::%player%} to unix timestamp of now
			stop
	set {lastSender} to player
	set {lastMessage::%player%} to unix timestamp of now

a teraz? @gnomq2000

Edytowane przez PanMaruda
Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259970
Udostępnij na innych stronach

  • 0
17 minut temu, gnomq2000 napisał:

Jeśli gracz napisze na czacie szybko 2 wiadomości pod sobą, to kolejną będzie mógł wysłać dopiero za 5 sekund i wiadomość: następna wiadomość możesz napisać za: X sekund z odliczaniem

Chciałeś, aby po napisaniu dwóch wiadomości było blokowanie, więc tak też postarałem się zrobić.

on chat:
	add 1 to {chat::messages::%player%}
	if {chat::cooldown::%player%} is not set:
		set {chat::cooldown::%player%} to now
	if {chat::messages::%player%} is 2:
		if difference between {chat::messages::%player%} and now is less than 5 seconds:
			cancel event
			set {_c} to {chat::messages::%player%}
			add 5 seconds to {_c}
			set {_c} to difference between {_c} and now
			set {_c} to translateTimespan({_c})
			send "&cMusisz odczekac jeszcze &6%{_c}%&c!" to player
			set {chat::messages::%player%} to 0
			stop
	set {chat::cooldown::%player%} to now
	
every 2 seconds:
	loop {chat::messages::*}:
		remove 1 from {chat::messages::%loop-index%}

 

Edytowane przez Kormic
Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259971
Udostępnij na innych stronach

  • 0
7 minut temu, PanMaruda napisał:

on chat:
	if unix timestamp of now - {cooldownMsg::%player%} < 5:
		cancel event
		send "odczekaj jeszcze %(unix timestamp of now - {cooldownMsg::%player%})% sekund"
		stop
	if {lastSender} is player:
		if unix timestamp of now - ({cooldownMsg::%player%} ? 0) < 5:
			set {cooldownMsg::%player%} to unix timestamp of now
			stop
	set {lastSender} to player
	

 

mogę wciąż spamować, a błędów brak

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259972
Udostępnij na innych stronach

  • 0
2 minuty temu, Kormic napisał:

Chciałeś, aby po napisaniu dwóch wiadomości było blokowanie, więc tak też postarałem się zrobić.


on chat:
	add 1 to {chat::messages::%player%}
	if {chat::cooldown::%player%} is not set:
		set {chat::cooldown::%player%} to now
	if {chat::messages::%player%} is 2:
		if difference between {chat::messages::%player%} and now is less than 5 seconds:
			cancel event
			set {_c} to {chat::messages::%player%}
			add 5 seconds to {_c}
			set {_c} to difference between {_c} and now
			set {_c} to translateTimespan({_c})
			send "&cMusisz odczekac jeszcze &6%{_c}%&c!" to player
			set {chat::messages::%player%} to 0
			stop
	set {chat::cooldown::%player%} to now
	
every 2 seconds:
	loop {chat::messages::*}:
		remove 1 from {chat::messages::%loop-index%}

 

mogę wciąż spamować, a błędów brak

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259973
Udostępnij na innych stronach

  • 0
27 minut temu, PanMaruda napisał:

on chat:
	if {cooldownMsg::%player%} is not set:
		set {cooldownMsg::%player%} to 0
	if unix timestamp of now - {cooldownMsg::%player%} < 5:
		cancel event
		send "odczekaj jeszcze %(unix timestamp of now - {cooldownMsg::%player%})% sekund"
		stop
	if {lastSender} is player:
		if unix timestamp of now - {lastMessage::%player%} < 5:
			set {cooldownMsg::%player%} to unix timestamp of now
			stop
	set {lastSender} to player
	set {lastMessage::%player%} to unix timestamp of now

a teraz? @gnomq2000

dzięki śliczne działa jak należy :)

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259975
Udostępnij na innych stronach

  • 0
19 minut temu, gnomq2000 napisał:

mogę wciąż spamować, a błędów brak

Dobra, poprawiłem i wszystko ładnie działa.

function translateTimespan(t: timespan) :: text:
	set {_t} to "%{_t}%"
	replace all "seconds" with "sekund" in {_t}
	replace all "second" with "sekunde" in {_t}
	replace all "minutes" with "minut" in {_t}
	replace all "minute" with "minute" in {_t}
	replace all "hours" with "godzin" in {_t}
	replace all "hour" with "godzine" in {_t}
	replace all "months" with "miesiecy" in {_t}
	replace all "month" with "miesiac" in {_t}
	replace all "years" with "lat" in {_t}
	replace all "year" with "rok" in {_t}
	return "%{_t}%"

on chat:
	add 1 to {chat::messages::%player%}
	if {chat::cooldown::%player%} is not set:
		set {chat::cooldown::%player%} to now
	if {chat::messages::%player%} is greater than or equal to 2:
		if difference between {chat::cooldown::%player%} and now is less than 5 seconds:
			cancel event
			set {_c} to {chat::cooldown::%player%}
			add 5 seconds to {_c}
			set {_c} to difference between {_c} and now
			set {_t} to {_c}
			set {_c} to translateTimespan({_c})
			send "&cMusisz odczekac jeszcze &6%{_c}%&c!" to player
			wait {_t}
			set {chat::messages::%player%} to 0
			stop
	set {chat::cooldown::%player%} to now
	
every 2 seconds:
	loop {chat::messages::*}:
		if {chat::messages::%loop-index%} is greater than 0:
			remove 1 from {chat::messages::%loop-index%}

 

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259977
Udostępnij na innych stronach

  • 0
6 minut temu, Kormic napisał:

Dobra, poprawiłem i wszystko ładnie działa.


function translateTimespan(t: timespan) :: text:
	set {_t} to "%{_t}%"
	replace all "seconds" with "sekund" in {_t}
	replace all "second" with "sekunde" in {_t}
	replace all "minutes" with "minut" in {_t}
	replace all "minute" with "minute" in {_t}
	replace all "hours" with "godzin" in {_t}
	replace all "hour" with "godzine" in {_t}
	replace all "months" with "miesiecy" in {_t}
	replace all "month" with "miesiac" in {_t}
	replace all "years" with "lat" in {_t}
	replace all "year" with "rok" in {_t}
	return "%{_t}%"

on chat:
	add 1 to {chat::messages::%player%}
	if {chat::cooldown::%player%} is not set:
		set {chat::cooldown::%player%} to now
	if {chat::messages::%player%} is greater than or equal to 2:
		if difference between {chat::cooldown::%player%} and now is less than 5 seconds:
			cancel event
			set {_c} to {chat::cooldown::%player%}
			add 5 seconds to {_c}
			set {_c} to difference between {_c} and now
			set {_t} to {_c}
			set {_c} to translateTimespan({_c})
			send "&cMusisz odczekac jeszcze &6%{_c}%&c!" to player
			wait {_t}
			set {chat::messages::%player%} to 0
			stop
	set {chat::cooldown::%player%} to now
	
every 2 seconds:
	loop {chat::messages::*}:
		if {chat::messages::%loop-index%} is greater than 0:
			remove 1 from {chat::messages::%loop-index%}

 

dziwne bo wciąż mogę spamować :thonk: 

 

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259981
Udostępnij na innych stronach

  • 0
5 minut temu, gnomq2000 napisał:

naprawdę, a błędów brak

Nawet skopiowałem skrypt, który tutaj do wątku wrzuciłem i u mnie wszystko ładnie działa. No nic, jak nie działa to trudno, zresztą rozwiązanie już masz.

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259985
Udostępnij na innych stronach

  • 0
58 minut temu, PanMaruda napisał:

on chat:
	if {cooldownMsg::%player%} is not set:
		set {cooldownMsg::%player%} to 0
	if unix timestamp of now - {cooldownMsg::%player%} < 5:
		cancel event
		send "odczekaj jeszcze %(unix timestamp of now - {cooldownMsg::%player%})% sekund"
		stop
	if {lastSender} is player:
		if unix timestamp of now - {lastMessage::%player%} < 5:
			set {cooldownMsg::%player%} to unix timestamp of now
			stop
	set {lastSender} to player
	set {lastMessage::%player%} to unix timestamp of now

a teraz? @gnomq2000

tylko odlicza mi te sekundy od tyłu xd :angrythonk:

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259986
Udostępnij na innych stronach

  • 0
4 minuty temu, gnomq2000 napisał:

tylko odlicza mi te sekundy od tyłu xd :angrythonk:

Jeśli dobrze zrozumiałem to przykładowo zamiast 1 masz 4, tak? Musisz zmienić linijkę nr 6, a konkretnie działanie na '{cooldownMsg::%player%} - unix timestamp of now'.

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259987
Udostępnij na innych stronach

  • 0
1 minutę temu, Kormic napisał:

Jeśli dobrze zrozumiałem to przykładowo zamiast 1 masz 4, tak? Musisz zmienić linijkę nr 6, a konkretnie działanie na '{cooldownMsg::%player%} - unix timestamp of now'.

Mrojkoj.png

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259988
Udostępnij na innych stronach

  • 0
on chat:
	if {cooldownMsg::%player%} is not set:
		set {cooldownMsg::%player%} to 0
	if unix timestamp of now < {cooldownMsg::%player%}:
		cancel event
		send "odczekaj jeszcze %(unix timestamp of now - {cooldownMsg::%player%})% sekund"
		stop
	if {lastSender} is player:
		if unix timestamp of now - {lastMessage::%player%} < 5:
			set {cooldownMsg::%player%} to unix timestamp of now + 5
			stop
	set {lastSender} to player
	set {lastMessage::%player%} to unix timestamp of now

a zobacz takie

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259991
Udostępnij na innych stronach

  • 0
1 minutę temu, PanMaruda napisał:

on chat:
	if {cooldownMsg::%player%} is not set:
		set {cooldownMsg::%player%} to 0
	if unix timestamp of now < {cooldownMsg::%player%}:
		cancel event
		send "odczekaj jeszcze %(unix timestamp of now - {cooldownMsg::%player%})% sekund"
		stop
	if {lastSender} is player:
		if unix timestamp of now - {lastMessage::%player%} < 5:
			set {cooldownMsg::%player%} to unix timestamp of now + 5
			stop
	set {lastSender} to player
	set {lastMessage::%player%} to unix timestamp of now

a zobacz takie

odlicza dobrze, ale z minusem

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259992
Udostępnij na innych stronach

  • 0
Teraz, gnomq2000 napisał:

odlicza dobrze, ale z minusem

a nie wkleiłeś sobie tych odwróconych zmiennych przypadkiem? a jeżeli nie, to ich odwróć właśnie

skript dziwnie ten czas odlicza i zawsze to jest przekręcone jakoś

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259993
Udostępnij na innych stronach

  • 0
2 minuty temu, PanMaruda napisał:

a nie wkleiłeś sobie tych odwróconych zmiennych przypadkiem? a jeżeli nie, to ich odwróć właśnie

skript dziwnie ten czas odlicza i zawsze to jest przekręcone jakoś

działa dzięks!

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-259994
Udostępnij na innych stronach

  • 0
Godzinę temu, PanMaruda napisał:

on chat:
	if {cooldownMsg::%player%} is not set:
		set {cooldownMsg::%player%} to 0
	if unix timestamp of now < {cooldownMsg::%player%}:
		cancel event
		send "odczekaj jeszcze %(unix timestamp of now - {cooldownMsg::%player%})% sekund"
		stop
	if {lastSender} is player:
		if unix timestamp of now - {lastMessage::%player%} < 5:
			set {cooldownMsg::%player%} to unix timestamp of now + 5
			stop
	set {lastSender} to player
	set {lastMessage::%player%} to unix timestamp of now

a zobacz takie

dodasz mi do tego permisję?

Odnośnik do komentarza
https://skript.pl/temat/41528-pisanie-na-czacie/#findComment-260005
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ę...