Skocz do zawartości
  • 0

BILET DO METRA


dimsongopl

Pytanie

Chciałbym skrypt na 3 bilety do metra:         

Jednorazowe za 5$ 

15 minutowe za 10$

45 minutowe za 35$

i żeby jak sie nie mialo tych biletów to nie dało się wejść do żadnych wagoników

Do kupienia biletów chciałbym komende /metro i tam bedzie gui z tymi 3 biletami 

Odnośnik do komentarza
https://skript.pl/temat/57983-bilet-do-metra/
Udostępnij na innych stronach

9 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0

NIe testowane  bo zabrakło czasu:
 

Options:
    jednorazowy: paper named "&2Bilet jednorazowy" with lore "" and "&bBilet upoważnia do" and "&2jednorazowego" and "&bprzejazdu metrem!"
    15_min: paper named "&aBilet 15 minutowy" with lore "" and "&bBilet upoważnia do" and "&a15 minutowego" and "&bporuszania się metrem!"
    45_min: paper named "&dBilet 45 minutowy" with lore "" and "&bBilet upoważnia do" and "&d45 minutowego" and "&bporuszania się metrem!"
    nazwa_gui: "KASA METRA"

function metro(p:player):
    set {_gui} to chest inventory with 1 row named {@nazwa_gui}
    set slot (integers between 0 and 8) of {_gui} to light gray stained glass pane named "&7"
    set slot 0 of {_gui} to sunflower named "&eStan konta:" with lore "" and "&b%{_p}'s balance%"
    set {_lore::*} to lore of {@jednorazowy}
    set slot 2 of {_gui} to {@jednorazowy} with lore {_lore::*} and "&fCena:&e 5$"  and "&eKliknij, aby kupić!"
    set {_lore::*} to lore of {@15_min}
    set slot 4 of {_gui} to {@15_min} with lore {_lore::*} and "&fCena:&e 10$"  and "&eKliknij, aby kupić!"
    set {_lore::*} to lore of {@45_min}
    set slot 6 of {_gui} to {@45_min} with lore {_lore::*} and "&fCena:&e 35$" and "&eKliknij, aby kupić!"
    set slot 8 of {_gui} to barrier named "&dWyjście" with lore "" and "&eKliknij, aby wyjść!"
    open {_gui} to {_p}
function modular(x:number, y: number)::text:
    set {_mod} to mod({_x}, {_y})
    if {_mod} is set:
        if {_mod} > 0:
            set {_minutes} to floor({_x} / {_y})
            set {seconds} to {_mod}        
            set {_time} to "%{_minutes}%m %{seconds}%s"
            return {_time}
        else: 
            set {_minutes} to floor({_x} / {_y})
            set {_time} to "%{_minutes}%m"
            return {_time}

command /metro:
    trigger: 
        metro(player)
on vehicle enter:
    player's vehicle is a minecart
    if player has {@jednorazowy}:
        send "Zużyłes bilet jednorazowy! Miłaj podróży!" to player
        remove {@jednorazowy} from player's inventory

    else if {bilet.%player's name%.czas} is 0:
        if player has {@15_min}:
            remove {@15_min} from player's inventory
            set {bilet.%player's name%.czas} to 900
        else if player has {@45_min}:
            remove {@45_min} from player's inventory
            set {bilet.%player's name%.czas} to 2700
    else if {bilet.%player's name%.czas} > 0:
        send "Użyłeś bilet'u! Czas pozostały na bilecie: %modular({bilet.%player's name%.czas}, 60)%.Miłaj podróży!" to player
        while player is riding minecart:
            wait 1 seconds
            remove 1 from {bilet.%player's name%.czas}
            if {bilet.%player's name%.czas} is 60:
                send "&cUWAGA! Czas pozostały na bilecie to mniej niż 60s" to player
    else:
        cancel event
        send "&cNIe posiadasz biletu!" to player
on vehicle exit:
    if {bilet.%player's name%.czas} > 0 seconds:
        send "Czas pozostały na bilecie: %modular({bilet.%player's name%.czas}, 60)%s" to player
        
on inventory click:
    if name of event-inventory is {@nazwa_gui}:
        cancel event
        if slot is "2":
            remove 5 from the player's balance
            give {@jednorazowy} to player
        if slot is "4":
            remove 10 from the player's balance
            give {@15_min} to player
        if slot is "6":
            remove 35 from the player's balance
            give {@45_min} to player
on join:
    if {bilet.%player's name%.czas} is not set:
        set {bilet.%player's name%.czas} to 0

 

Odnośnik do komentarza
https://skript.pl/temat/57983-bilet-do-metra/#findComment-344392
Udostępnij na innych stronach

  • 0

wybacz.. tym razem kod jest przetestowany i sprawny w 100%:
 

Options:
    bilet_item: paper
    jednorazowy_nazwa: "&2Bilet jednorazowy" 
    15_min_nazwa: "&aBilet 15 minutowy" 
    45_min_nazwa: "&dBilet 45 minutowy" 
    jednorazowy_lore: "" and "&bBilet upoważnia do" and "&2jednorazowego" and "&bprzejazdu metrem!"
    15_min_lore: "" and "&bBilet upoważnia do" and "&a15 minutowego" and "&bporuszania się metrem!"
    45_min_lore: "" and "&bBilet upoważnia do" and "&d45 minutowego" and "&bporuszania się metrem!"
    nazwa_gui: "KASA METRA"

function metro(p:player):
    set {_gui} to chest inventory with 1 row named {@nazwa_gui}
    set slot (integers between 0 and 8) of {_gui} to light gray stained glass pane named "&7"
    set slot 0 of {_gui} to sunflower named "&eStan konta:" with lore "" and "&b%{_p}'s balance%"
    set slot 2 of {_gui} to {@bilet_item} named {@jednorazowy_nazwa} with lore {@jednorazowy_lore} and "&fCena:&e 5$"  and "&eKliknij, aby kupić!"
    set slot 4 of {_gui} to {@bilet_item} named {@15_min_nazwa} with lore {@15_min_lore} and "&fCena:&e 10$"  and "&eKliknij, aby kupić!"
    set slot 6 of {_gui} to {@bilet_item} named {@45_min_nazwa} with lore {@45_min_lore} and "&fCena:&e 35$" and "&eKliknij, aby kupić!"
    set slot 8 of {_gui} to barrier named "&dWyjście" with lore "" and "&eKliknij, aby wyjść!"
    open {_gui} to {_p}
function modular(x:number, y: number)::text:
    set {_mod} to mod({_x}, {_y})
    if {_mod} is set:
        if {_mod} > 0:
            set {_minutes} to floor({_x} / {_y})
            set {seconds} to {_mod}        
            set {_time} to "%{_minutes}%m %{seconds}%s"
            return {_time}
        else: 
            set {_minutes} to floor({_x} / {_y})
            set {_time} to "%{_minutes}%m"
            return {_time}

command /metro:
    trigger: 
        metro(player)
        

on vehicle enter:   
    player's vehicle is a regular minecart

    if {bilet.%player's name%.czas} > 0:
        send "Użyłeś bilet'u! Czas pozostały na bilecie: %modular({bilet.%player's name%.czas}, 60)%.Miłaj podróży!" to player
        while player is riding minecart:
            wait 1 seconds
            remove 1 from {bilet.%player's name%.czas}
            if {bilet.%player's name%.czas} is 60:
                send "&cUWAGA! Czas pozostały na bilecie to mniej niż 60s" to player
    else if player has {@bilet_item} named {@jednorazowy_nazwa}:
        send "Zużyłes bilet jednorazowy! Miłaj podróży!" to player
        remove {@bilet_item} named {@jednorazowy_nazwa} from player

    else if {bilet.%player's name%.czas} is 0:
        if player has {@bilet_item} named {@15_min_nazwa}:
            remove {@bilet_item} named {@15_min_nazwa} from player
            set {bilet.%player's name%.czas} to 900
        else if player has {@bilet_item} named {@45_min_nazwa}:
            remove {@bilet_item} named {@45_min_nazwa} from player
            set {bilet.%player's name%.czas} to 2700  
        else:
            cancel event
            send "&cNie posiadasz biletu! (&e/metro&c)" to player
    else:
        cancel event
        send "&cNie posiadasz biletu! (&e/metro&c)" to player
on vehicle exit:
    if {bilet.%player's name%.czas} > 0 seconds:
        send "Czas pozostały na bilecie: %modular({bilet.%player's name%.czas}, 60)%s" to player
        
on inventory click:
    if name of event-inventory is {@nazwa_gui}:
        cancel event
        if clicked slot is 2:
            remove 5 from the player's balance
            give {@bilet_item} named {@jednorazowy_nazwa} with lore {@jednorazowy_lore} to player
        if clicked slot is 4:
            remove 10 from the player's balance
            give {@bilet_item} named {@15_min_nazwa} with lore {@15_min_lore} to player
        if clicked slot is 6:
            remove 35 from the player's balance
            give {@bilet_item} named {@45_min_nazwa} with lore {@45_min_lore} to player
        if clicked slot is 8:
            close player's inventory
on join:
    if {bilet.%player's name%.czas} is not set:
        set {bilet.%player's name%.czas} to 0

 

Edytowane przez Saanjuk
Odnośnik do komentarza
https://skript.pl/temat/57983-bilet-do-metra/#findComment-344413
Udostępnij na innych stronach

  • 0

to tym lepiej bo teraz się zorientowałem że coś nie bardzo chce to odliczać gdy się jedzie...


prosze o to wersja kodu w której czas rozpoczyna się w momencie gdy gracz wsiada do wagonika używając biletu i liczony jest cały czas:

 

Options:
    bilet_item: paper
    jednorazowy_nazwa: "&2Bilet jednorazowy" 
    15_min_nazwa: "&aBilet 15 minutowy" 
    45_min_nazwa: "&dBilet 45 minutowy" 
    jednorazowy_lore: "" and "&bBilet upoważnia do" and "&2jednorazowego" and "&bprzejazdu metrem!"
    15_min_lore: "" and "&bBilet upoważnia do" and "&a15 minutowego" and "&bporuszania się metrem!"
    45_min_lore: "" and "&bBilet upoważnia do" and "&d45 minutowego" and "&bporuszania się metrem!"
    nazwa_gui: "KASA METRA"

function metro(p:player):
    set {_gui} to chest inventory with 1 row named {@nazwa_gui}
    set slot (integers between 0 and 8) of {_gui} to light gray stained glass pane named "&7"
    set slot 0 of {_gui} to sunflower named "&eStan konta:" with lore "" and "&b%{_p}'s balance%"
    set slot 2 of {_gui} to {@bilet_item} named {@jednorazowy_nazwa} with lore {@jednorazowy_lore} and "&fCena:&e 5$"  and "&eKliknij, aby kupić!"
    set slot 4 of {_gui} to {@bilet_item} named {@15_min_nazwa} with lore {@15_min_lore} and "&fCena:&e 10$"  and "&eKliknij, aby kupić!"
    set slot 6 of {_gui} to {@bilet_item} named {@45_min_nazwa} with lore {@45_min_lore} and "&fCena:&e 35$" and "&eKliknij, aby kupić!"
    set slot 8 of {_gui} to barrier named "&dWyjście" with lore "" and "&eKliknij, aby wyjść!"
    open {_gui} to {_p}
function modular(x:number, y: number)::text:
    set {_mod} to mod({_x}, {_y})
    if {_mod} is set:
        if {_mod} > 0:
            set {_minutes} to floor({_x} / {_y})
            set {seconds} to {_mod}        
            set {_time} to "%{_minutes}%m %{seconds}%s"
            return {_time}
        else: 
            set {_minutes} to floor({_x} / {_y})
            set {_time} to "%{_minutes}%m"
            return {_time}

command /metro:
    trigger: 
        metro(player)
        

on vehicle enter:   
    player's vehicle is a regular minecart

    if {bilet.%player's name%.czas} > 0:
        send "Użyłeś bilet'u! Czas pozostały na bilecie: %modular({bilet.%player's name%.czas}, 60)%.Miłaj podróży!" to player

    else if player has {@bilet_item} named {@jednorazowy_nazwa}:
        send "Zużyłes bilet jednorazowy! Miłaj podróży!" to player
        remove {@bilet_item} named {@jednorazowy_nazwa} from player

    else if {bilet.%player's name%.czas} is 0:
        if player has {@bilet_item} named {@15_min_nazwa}:
            remove {@bilet_item} named {@15_min_nazwa} from player
            set {bilet.%player's name%.czas} to 900
        else if player has {@bilet_item} named {@45_min_nazwa}:
            remove {@bilet_item} named {@45_min_nazwa} from player
            set {bilet.%player's name%.czas} to 2700  
        else:
            cancel event
            send "&cNie posiadasz biletu! (&e/metro&c)" to player
    else:
        cancel event
        send "&cNie posiadasz biletu! (&e/metro&c)" to player

on vehicle exit:
    if {bilet.%player's name%.czas} > 0 seconds:
        send "Czas pozostały na bilecie: %modular({bilet.%player's name%.czas}, 60)%s" to player
        
on inventory click:
    if name of event-inventory is {@nazwa_gui}:
        cancel event
        if clicked slot is 2:
            remove 5 from the player's balance
            give {@bilet_item} named {@jednorazowy_nazwa} with lore {@jednorazowy_lore} to player
        if clicked slot is 4:
            remove 10 from the player's balance
            give {@bilet_item} named {@15_min_nazwa} with lore {@15_min_lore} to player
        if clicked slot is 6:
            remove 35 from the player's balance
            give {@bilet_item} named {@45_min_nazwa} with lore {@45_min_lore} to player
        if clicked slot is 8:
            close player's inventory
on join:
    if {bilet.%player's name%.czas} is not set:
        set {bilet.%player's name%.czas} to 0
    while {bilet.%player's name%.czas} > 0:
        wait 1 seconds
        set {bilet.%player's name%.czas} to ({bilet.%player's name%.czas} -1)

 

Edytowane przez Saanjuk
Odnośnik do komentarza
https://skript.pl/temat/57983-bilet-do-metra/#findComment-344425
Udostępnij na innych stronach

Dołącz do dyskusji

Możesz dodać zawartość już teraz a zarejestrować się później. Jeśli posiadasz już konto, zaloguj się aby dodać zawartość za jego pomocą.

Nieaktywny
Odpowiedz na pytanie...

×   Wklejono zawartość z formatowaniem.   Usuń formatowanie

  Dozwolonych jest tylko 75 emoji.

×   Odnośnik został automatycznie osadzony.   Przywróć wyświetlanie jako odnośnik

×   Przywrócono poprzednią zawartość.   Wyczyść edytor

×   Nie możesz bezpośrednio wkleić grafiki. Dodaj lub załącz grafiki z adresu URL.

  • Ostatnio przeglądający   0 użytkowników

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