Skocz do zawartości
  • 0

Nie działa skrypt


Pytanie

Potrzebuję pomocy, robię prywatny serwer skyblock (dla mnie i dla kolegów), lecz nie działa skrypt na sprzedawanie i kupowanie rzeczy.

Nie dodaje monet jak się sprzedaję np bruk komendą /sell

KOD:

variables:
    {coins} = "0"

command /sell [<text>]:
    trigger:
        if arg 1 is "cobblestone" or "bruk":
            if player has 64 cobblestone:
                remove 64 cobblestone from player's inventory
                add "0.1" to {coins.%player%}
                send "&2Wymieniles bruk!"
            else:
                send "&cNie masz 64 bruku!"
        if arg 1 is "mieso":
            if player has 64 raw beef:
                remove 64 raw beef from player's inventory
                add "0.1" to {coins.%player%}
                send "&2Wymieniles mieso!"
            else:
                send "&cNie masz 64 miesa!"
        if arg 1 is "skora" or "skore":
            if player has 64 leather:
                remove 64 leather from player's inventory
                add "0.1" to {coins.%player%}
                send "&2Wymieniles skore!"
            else:
                send "&cNie masz 64 skory!"
        if arg 1 is not set:
            send "&8Poprawne uzycie komendy:"
            send "&7/sell bruk"
            send "&7/sell mieso"
            send "&7/sell skore"
            
command /buy [<text>]:
    trigger:
        if arg 1 is "spawner":
            if {coins.%player%} >= 10:
                remove "10" from {coins.%player%}
                give 1 mob spawner to player's inventory
            else:
                send "&cNie masz tyle monet!"
        if arg 1 is "stoniarka":
            if {coins.%player%} >= 0.5:
                remove "0.5" from {coins.%player%}
                give 1 end stone to player's inventory
            else:
                send "&cNie masz tyle monet!"
                
command /money:
    aliases: hajs, kasa, monety
    trigger:
        send "&eMasz %{coins.%player%}% monet!"
        
command /test:
    trigger:
        add "10" to {coins.%player%}

 

Edytowane przez ZawodowyPisarz
Odnośnik do komentarza
https://skript.pl/temat/27873-nie-dzia%C5%82a-skrypt/
Udostępnij na innych stronach

17 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
1 minutę temu, ZawodowyPisarz napisał:

Nie dodaje monet do /monety

Zmień
 

command /test:
    trigger:
        add "10" to {coins.%player%}

na
 

command /test:
    trigger:
        add 10 to {coins.%player%}

 

Odnośnik do komentarza
https://skript.pl/temat/27873-nie-dzia%C5%82a-skrypt/#findComment-184668
Udostępnij na innych stronach

  • 0
1 minutę temu, ZawodowyPisarz napisał:

Nadal nie dodaje.

command /sell [<text>]:
    trigger:
        if arg 1 is "cobblestone" or "bruk":
            if player has 64 cobblestone:
                remove 64 cobblestone from player's inventory
                add "0.1" to {coins.%player%}
                send "&2Wymieniles bruk!"
            else:
                send "&cNie masz 64 bruku!"
        if arg 1 is "mieso":
            if player has 64 raw beef:
                remove 64 raw beef from player's inventory
                add "0.1" to {coins.%player%}
                send "&2Wymieniles mieso!"
            else:
                send "&cNie masz 64 miesa!"
        if arg 1 is "skora" or "skore":
            if player has 64 leather:
                remove 64 leather from player's inventory
                add "0.1" to {coins.%player%}
                send "&2Wymieniles skore!"
            else:
                send "&cNie masz 64 skory!"
        if arg 1 is not set:
            send "&8Poprawne uzycie komendy:"
            send "&7/sell bruk"
            send "&7/sell mieso"
            send "&7/sell skore"

na

command /sell [<text>]:
    trigger:
        if arg 1 is "cobblestone" or "bruk":
            if player has 64 cobblestone:
                remove 64 cobblestone from player's inventory
                add 0.1 to {coins.%player%}
                send "&2Wymieniles bruk!"
            else:
                send "&cNie masz 64 bruku!"
        if arg 1 is "mieso":
            if player has 64 raw beef:
                remove 64 raw beef from player's inventory
                add 0.1 to {coins.%player%}
                send "&2Wymieniles mieso!"
            else:
                send "&cNie masz 64 miesa!"
        if arg 1 is "skora" or "skore":
            if player has 64 leather:
                remove 64 leather from player's inventory
                add 0.1 to {coins.%player%}
                send "&2Wymieniles skore!"
            else:
                send "&cNie masz 64 skory!"
        if arg 1 is not set:
            send "&8Poprawne uzycie komendy:"
            send "&7/sell bruk"
            send "&7/sell mieso"
            send "&7/sell skore"

 

Odnośnik do komentarza
https://skript.pl/temat/27873-nie-dzia%C5%82a-skrypt/#findComment-184671
Udostępnij na innych stronach

  • 0
22 minuty temu, ZawodowyPisarz napisał:

Nie ma błędów

dobra, wiem. Dodajesz setne, prawdopodobnie nie można ich dodawać, ale też możliwe może być to, że nie ma jeszcze pełnej złotówki, aby Ci się wyświetliło. Zmień 0.1 na np. 4 i zobacz. @ZawodowyPisarz

Odnośnik do komentarza
https://skript.pl/temat/27873-nie-dzia%C5%82a-skrypt/#findComment-184675
Udostępnij na innych stronach

  • 0

@ZawodowyPisarz musisz pamiętać że chcąc robić zmienną z liczbą nie możesz dawać jej w cudzysłowie, bo wtedy zostanie zapisana jako tekst.

Czyli:

1)

{jestem::sobie::tekstem} = "5"
add "5" to {jestem::sobie::tekstem}

Taki zapis nie zadziała z dwóch powodów: zmienna jest zapisana jako tekst, druga: do zmiennej chcemy dodać tekst co jest niemożliwe.

2)

{jestem::sobie::tekstem} = "5"
add 5 to {jestem::sobie::tekstem}

I tutaj znów mamy problem gdyż zmienna jest zapisana jako tekst, chcemy dodać do niej liczbę, co również nie zadziała.

3)

Takie coś można naprawić dłuższym sposobem ustawiając tą zmienna jako liczbę tylko dla danej linijki (o ile masz pewność ze zmienna zawiera tylko liczbę i nie ma żadnych liter/znaków)

{jestem::sobie::tekstem} = "5"
add 5 to {jestem::sobie::tekstem} parsed as integer/number

4)

Najlepszym sposobem jest zapisanie zmiennej jako liczbę i potem operowanie na niej:

{jestem::sobie::liczbą} = 5
add 5 to {jestem::sobie::liczbą}
variables:
    {coins} = 0
	command /sell [<text>]:
    trigger:
        if arg 1 is "cobblestone" or "bruk":
            if player has 64 cobblestone:
                remove 64 cobblestone from player's inventory
                add 0.1 to {coins.%player%}
                send "&2Wymieniles bruk!"
            else:
                send "&cNie masz 64 bruku!"
        if arg 1 is "mieso":
            if player has 64 raw beef:
                remove 64 raw beef from player's inventory
                add 0.1 to {coins.%player%}
                send "&2Wymieniles mieso!"
            else:
                send "&cNie masz 64 miesa!"
        if arg 1 is "skora" or "skore":
            if player has 64 leather:
                remove 64 leather from player's inventory
                add 0.1 to {coins.%player%}
                send "&2Wymieniles skore!"
            else:
                send "&cNie masz 64 skory!"
        if arg 1 is not set:
            send "&8Poprawne uzycie komendy:"
            send "&7/sell bruk"
            send "&7/sell mieso"
            send "&7/sell skore"
command /buy [<text>]:
    trigger:
        if arg 1 is "spawner":
            if {coins.%player%} >= 10:
                remove 10 from {coins.%player%}
                give 1 mob spawner to player's inventory
            else:
                send "&cNie masz tyle monet!"
        if arg 1 is "stoniarka":
            if {coins.%player%} >= 0.5:
                remove 0.5 from {coins.%player%}
                give 1 end stone to player's inventory
            else:
                send "&cNie masz tyle monet!"
command /money:
    aliases: hajs, kasa, monety
    trigger:
        send "&eMasz %{coins.%player%}% monet!"
command /test:
    trigger:
        add 10 to {coins.%player%}


 

Spoiler

 

Druga sprawa która być może jest źle w twoim zapisie to dodawanie/usuwanie przedmiotów


give/remove <liczba> of <item> [of <enchant> <poziom enchantu>, ...] [named "<nazwa>"] [with lore "<lore>"] to/from <player>

Zatem:


give 1 of end stone to player
remove 64 of stone from player
give 1 of potato of fortune 100, knockback 10 named "&6Moja Pyra" with lore "&5Ziemniak Szczęścia||I Kartoflel" to player

 

 

 

 

Edytowane przez ZiemniaQ
Ziemniaki
Odnośnik do komentarza
https://skript.pl/temat/27873-nie-dzia%C5%82a-skrypt/#findComment-184677
Udostępnij na innych stronach

  • 1

@ZawodowyPisarz jak ma Ci to dodawać, jeżeli już zapisałeś ową zmienną na tekst?

Usuń plik variables.csv wgraj ten poprawiony skrypt i powinno wszystko dodawać i odejmować.

Pamiętaj tylko, Wyłącz serwer, usuń variables.csv, wgraj poprawiony skrypturuchom serwer

A niby taki zawodowypisarz, a jednak nie

 

No i ten variables.

variables:
    {coins} = 0

powinno być:

variables:
    {coins.%player%} = 0

 

Edytowane przez knugi
Odnośnik do komentarza
https://skript.pl/temat/27873-nie-dzia%C5%82a-skrypt/#findComment-184742
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ę...