Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Szukam] Skrypt na komendę co kilka minut


Rekomendowane odpowiedzi

Opublikowano

Potrzebuję skrypt na komendę, którą można użyć co 10 minut. Przykładowo niech tą komendą będzie /spawn. Daje lajki.

Pomogłem? Liczę na LIKE :D

  

Opublikowano

Tu masz przykład chociażby od oficjalnego autora skriptu (Ten skrypt jest już w paczce):

 

#
# This script is a template for commands which have a cooldown.
# I will add a more intuitive way of handling cooldowns/countdowns in the future,
# But for now please use something like this.
# Make sure that you do not use delays for cooldowns as they stop when the server stops.
#

# This command allows each player to get infinite cakes
# but the command has a cooldown of one minute (per player)
command /cake:
    description: Recieve a cake, but you can only do this once per minute!
    permission: cake.is_a_lie
    executable by: players
    trigger:
        # stores how long it's been since the player last used this command
        set {_waited} to difference between {cake.%player%.lastused} and now
        # checks whether the player has used the command within the last minute
        if {_waited} is less than a minute:
            message "You have to wait %difference between a minute and {_waited}% before you can use this command again!"
            stop
        
        # some condition which sould not start the cooldown
        # (if the player doesn't get the cake he should be able to use the command again immediately)
        player doesn't have space for a cake:
            message "You do not have enough space in your inventory to hold the cake!"
            stop
            
        # do the action of the command
        give a cake to the player
        
        # and finally start the cooldown
        set {cake.%player%.lastused} to now

W komendzie spawn może to wyglądać tak:

 

command /spawn:
    trigger:
        set {_waited} to difference between {spawn.%player%.lastused} and now
        if {_waited} is less than a 10 minute:
            send "Komendy mozna uzywac co 10 minut"
        teleport player to spawn

Pomogłem?? Kliknij Lubię To

Opublikowano

Przerobiłem trochę ten skrypt ale kiedy wpiszę komendę /rtp wyskakuje mi taka wiadomość: 

 

The skript 'czas.sk' infinitely repeated itself

on command "/rtp":
    set {_waited} to difference between {rtp.%player%.lastused} and now
    if {_waited} is less than a hour:
        send "Komendy /rtp mozna uzywac co godzine"
    execute player command "/rtp"

Pomogłem? Liczę na LIKE :D

  

Opublikowano

Spróbuj tak:

 

on command "/rtp":
    set {_waited} to difference between {rtp.%player%.lastused} and now
    if {_waited} is less than a hour:
        send "Komendy /rtp mozna uzywac co godzine"
        stop
    execute player command "/rtp"
    set {rtp.%player%.lastused} to now

PS. Sory, ale to co napisałem na górze nie było do końca poprawne, bo zapomniałem dać set

Pomogłem?? Kliknij Lubię To

Opublikowano

Spróbuj tak:

on command "/rtp":
    set {_waited} to difference between {rtp.%player%.lastused} and now
    if {_waited} is less than a hour:
        send "Komendy /rtp mozna uzywac co godzine"
        stop
    execute player command "/rtp"
    set {rtp.%player%.lastused} to now

PS. Sory, ale to co napisałem na górze nie było do końca poprawne, bo zapomniałem dać set

 

Dalej ten sam problem.

 

@Edit

@leszczu97

Niby działa, ale można jej używać cały czas.

Pomogłem? Liczę na LIKE :D

  

Opublikowano

Nie działa, ponieważ to się zapętla, dałeś on command rlb, a potem masz execute player command "/rlb"

 

on command "/rtp":
    cancel event
    set {_waited} to difference between {rtp.%player%.lastused} and now
    if {_waited} is less than a hour:
        send "Komendy /rtp mozna uzywac co godzine   %difference between a hour and {_waited}%"
        stop
    execute player command "/help"
    set {rtp.%player%.lastused} to now
    stop

To u mnie działa komendy nie można używać cały czas. Nawet dodałem tam licznik, żebyś wiedział za ile możesz tego użyć jak chcesz to przetestuj sobie daj na minute.
 

Pomogłem?? Kliknij Lubię To

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...