Bulundu [SKRIPT] Event

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

yusufking01

Odunlara Vur Vur Vur!
Katılım
22 Mart 2025
Mesajlar
37
Elmaslar
3
Puan
895
Yaş
22
Konum
İstanbul
Minecraft
ytyusufking

Discord:

ytyusufking

Boxpvp ve Towny oyun modları barındıran sunucum için event (etkinlik) skripti istiyorum sunucu sürümü 1.19.4 Java 17
 
Boxpvp ve Towny oyun modları barındıran sunucum için event (etkinlik) skripti istiyorum sunucu sürümü 1.19.4 Java 17
Etkinlik detayı nedir? Nasıl bir event istiyorsunuz? bu bilgileri verirseniz yardımcı olmaya çalışalım.
 
Merhaba nasıl birşey istersiniz
 
BoxPvP’e özel Kill Race
Towny dünyasında Block Break Race
Sadece Towny bölgesinde/haricinde sayma için hazır yorum satırı
Otomatik event sistemi
(süreli)
GUI /event menüsü
Title + ActionBar duyuruları

Kazanana para + item + konsol komutları (tag/permission/prefix için)

Kodu kendi sunucuna göre düzenlemen gerekir


Kod:
# ============================================
#  Event Sistemi - BoxPvP & Towny
#  Sürüm: 1.19.4 / Java 17
#  Gerekli: Skript 2.6+ (önerilir)
#  İsteğe bağlı: Ekonomi (EssentialsX/CMI vb)
# ============================================

options:
    prefix: "&8[&bEvent&8]&r "

    # Dünya isimleri
    boxpvp-world: "boxpvp_world"
    towny-world: "towny_world"

    # Event sıklığı / süresi (dakika)
    event-interval-minutes: 30
    event-duration-minutes: 15

    # Kill Race ayarları (BoxPvP)
    killrace-kill-goal: 10
    killrace-reward-money: 5000
    killrace-reward-item: diamond sword
    killrace-reward-item-amount: 1

    # Block Break Race ayarları (Towny)
    blockrace-break-goal: 50
    blockrace-block-type: stone
    blockrace-reward-money: 4000
    blockrace-reward-item: diamond pickaxe
    blockrace-reward-item-amount: 1

    # Towny claim kontrolü
    # true = sadece claim içinde say, false = her yerde say
    blockrace-only-claims: false

    # GUI ayarları
    event-gui-title: "&bEvent Menüsü"
    event-gui-rows: 3

# ============================================
#  Değişkenler
# ============================================
# {event.active}            -> true/false
# {event.type}              -> "killrace" / "blockrace"
# {event.players::*}        -> katılımcılar
# {event.progress.%player%} -> her oyuncunun ilerlemesi
# {event.goal}              -> hedef sayı
# {event.world}             -> aktif event dünyası
# {event.finish}            -> event bitiş zamanı (date)

on load:
    set {event.active} to false
    broadcast "{@prefix}&aEvent sistemi yüklendi!"
    set {event.next} to now
    add {@event-interval-minutes} minutes to {event.next}
    broadcast "{@prefix}&7Bir sonraki etkinlik &e{@event-interval-minutes} &7dk içinde başlayacak."

# ============================================
#  Zamanlayıcı: Otomatik Event Başlat
# ============================================

every 1 minute:
    if {event.active} is false:
        if {event.next} is before now:
            set {_r} to random integer between 1 and 2
            if {_r} = 1:
                startKillRace()
            else:
                startBlockRace()

# ============================================
#  KOMUT: /event ve /event join
# ============================================

command /event [<text>]:
    permission: event.player
    trigger:
        if arg-1 is "join":
            joinEvent(player)
            stop
        # GUI aç
        if {event.active} is true:
            openEventGUI(player)
        else:
            set {_minLeft} to difference between now and {event.next} parsed as minutes
            if {_minLeft} < 0:
                set {_minLeft} to 0
            send "{@prefix}&cŞu anda aktif etkinlik yok."
            send "{@prefix}&7Bir sonraki etkinlik yaklaşık &e%ceil({_minLeft})% dk &7sonra."

# ============================================
#  GUI: Event Menüsü
# ============================================

function openEventGUI(p: player):
    if {event.active} is false:
        send "{@prefix}&cŞu anda aktif etkinlik yok." to {_p}
        stop

    set {_rows} to {@event-gui-rows}
    set {_size} to {_rows} * 9
    open virtual chest inventory with size {_size} named "{@event-gui-title}" to {_p}

    wait 1 tick
    set {_inv} to current inventory of {_p}

    # Arka plan cam
    loop {_size} times:
        set slot (loop-number - 1) of {_inv} to stained glass pane named "&8"

    # Bilgi itemi
    if {event.type} = "killrace":
        set {_infoName} to "&bKill Race"
        set {_infoLore::*} to "&7Amaç: &e{@killrace-kill-goal} &7kill al.", "&7Dünya: &e{@boxpvp-world}", "&7Katılmak için: &a/event join &7veya &aGUI butonu"
        set {_infoItem} to iron sword
    else if {event.type} = "blockrace":
        set {_infoName} to "&dBlock Break Race"
        set {_infoLore::*} to "&7Amaç: &e{@blockrace-break-goal}x {@blockrace-block-type} kır.", "&7Dünya: &e{@towny-world}", "&7Katılmak için: &a/event join &7veya &aGUI butonu"
        set {_infoItem} to diamond pickaxe

    set slot 11 of {_inv} to {_infoItem} named {_infoName} with lore {_infoLore::*}

    # Katıl butonu
    set {_joinLore::*} to "&7Etkinliğe katılmak için tıkla!", "&7Aynı şey: &e/event join"
    set slot 15 of {_inv} to slime ball named "&aEtkinliğe Katıl" with lore {_joinLore::*}

    # Orta slot: durum
    if {_p} is in {event.players::*}:
        set {_status} to "&aZATEN KATILDIN"
    else:
        set {_status} to "&cKATILMADIN"

    set slot 13 of {_inv} to paper named "&eDurum: %{_status}%" with lore "&7Event türü: &e%{event.type}%"

on inventory click:
    if name of event-inventory is "{@event-gui-title}":
        cancel event
        if clicked slot is 15:
            joinEvent(player)

# ============================================
#  FONKSİYONLAR: Event Başlat / Bitir / Katıl
# ============================================

function resetEventTimer():
    set {event.next} to now
    add {@event-interval-minutes} minutes to {event.next}

function startKillRace():
    if {event.active} is true:
        stop
    set {event.active} to true
    set {event.type} to "killrace"
    clear {event.players::*}
    clear {event.progress::*}
    set {event.goal} to {@killrace-kill-goal}
    set {event.world} to "{@boxpvp-world}"
    set {event.finish} to now
    add {@event-duration-minutes} minutes to {event.finish}

    broadcast "{@prefix}&bKILL RACE &7etkinliği başladı!"
    broadcast "{@prefix}&7Dünya: &e{@boxpvp-world}"
    broadcast "{@prefix}&7Amaç: &e{@killrace-kill-goal} &7kill alan kazanır!"
    broadcast "{@prefix}&aKatılmak için: &e/event &7veya &e/event join"

    # Title & ActionBar
    send title "&bKILL RACE" with subtitle "&e/event &7yazarak katıl!" to all players
    send action bar "&bKill Race başladı! &e/event" to all players

function startBlockRace():
    if {event.active} is true:
        stop
    set {event.active} to true
    set {event.type} to "blockrace"
    clear {event.players::*}
    clear {event.progress::*}
    set {event.goal} to {@blockrace-break-goal}
    set {event.world} to "{@towny-world}"
    set {event.finish} to now
    add {@event-duration-minutes} minutes to {event.finish}

    broadcast "{@prefix}&dBLOCK BREAK &7etkinliği başladı!"
    broadcast "{@prefix}&7Dünya: &e{@towny-world}"
    broadcast "{@prefix}&7Amaç: &e{@blockrace-break-goal}x {@blockrace-block-type} kıran kazanır!"
    broadcast "{@prefix}&aKatılmak için: &e/event &7veya &e/event join"

    send title "&dBLOCK BREAK" with subtitle "&e/event &7yazarak katıl!" to all players
    send action bar "&dBlock Break başladı! &e/event" to all players

function joinEvent(p: player):
    if {event.active} is false:
        send "{@prefix}&cŞu anda aktif etkinlik yok." to {_p}
        stop

    # Dünya kontrolü (BoxPvP / Towny)
    if {event.type} = "killrace":
        if world of {_p} is not world "{@boxpvp-world}":
            send "{@prefix}&cKill Race için BoxPvP dünyasında olmalısın (&e{@boxpvp-world}&c)." to {_p}
            stop
    if {event.type} = "blockrace":
        if world of {_p} is not world "{@towny-world}":
            send "{@prefix}&cBlock Race için Towny dünyasında olmalısın (&e{@towny-world}&c)." to {_p}
            stop

    if {_p} is in {event.players::*}:
        send "{@prefix}&cZaten etkinliğe katıldın!" to {_p}
        stop

    add {_p} to {event.players::*}
    set {event.progress.%{_p}%} to 0
    send "{@prefix}&aEtkinliğe katıldın!" to {_p}

    if {event.type} = "killrace":
        send "{@prefix}&7Amaç: &e{@killrace-kill-goal} &7kill al." to {_p}
    if {event.type} = "blockrace":
        send "{@prefix}&7Amaç: &e{@blockrace-break-goal}x {@blockrace-block-type} kır." to {_p}

function endEventWinner(reason: text, winner: player):
    if {event.active} is false:
        stop

    broadcast "{@prefix}&aEtkinlik bitti! Kazanan: &e%{_winner}%"
    broadcast "{@prefix}&7Sebep: &f%{_reason}%"

    giveWinnerRewards({_winner})

    # Temizlik
    set {event.active} to false
    clear {event.players::*}
    clear {event.progress::*}
    delete {event.goal}
    delete {event.world}
    delete {event.finish}

    resetEventTimer()
    broadcast "{@prefix}&7Bir sonraki etkinlik &e{@event-interval-minutes} &7dk içinde başlayacak."

function endEventNoWinner(reason: text):
    if {event.active} is false:
        stop

    broadcast "{@prefix}&cEtkinlik kazanan olmadan bitti."
    broadcast "{@prefix}&7Sebep: &f%{_reason}%"

    set {event.active} to false
    clear {event.players::*}
    clear {event.progress::*}
    delete {event.goal}
    delete {event.world}
    delete {event.finish}

    resetEventTimer()
    broadcast "{@prefix}&7Bir sonraki etkinlik &e{@event-interval-minutes} &7dk içinde başlayacak."

# ============================================
#  ÖDÜLLER (Para + Item + Konsol Komutları)
# ============================================

function giveWinnerRewards(p: player):
    if {event.type} = "killrace":
        execute console command "eco give %name of {_p}% {@killrace-reward-money}"
        give {@killrace-reward-item} named "&bKill Race Ödülü" to {_p}
    if {event.type} = "blockrace":
        execute console command "eco give %name of {_p}% {@blockrace-reward-money}"
        give {@blockrace-reward-item} named "&dBlock Race Ödülü" to {_p}

    # BURAYI KENDİ SUNUCUNA GÖRE DÜZENLE:
    # Örnek LuckPerms komutları (istersen # kaldır):
    # execute console command "lp user %name of {_p}% parent addtemp event_kazanan 1d"
    # execute console command "lp user %name of {_p}% meta setsuffix 1 &6[Event]&r"

    send action bar "&6Tebrikler! Etkinliği kazandın!" to {_p}
    send "{@prefix}&6Ödüller hesabına tanımlandı!" to {_p}

# ============================================
#  Kill Race Mantığı (BoxPvP)
# ============================================

on death of player:
    if {event.active} is true:
        if {event.type} = "killrace":
            set {_killer} to attacker
            if {_killer} is a player:
                if {_killer} is in {event.players::*}:
                    if world of {_killer} is world "{@boxpvp-world}":
                        add 1 to {event.progress.%{_killer}%}
                        send action bar "&bKill: &e%{event.progress.%{_killer}%}% / {@killrace-kill-goal}" to {_killer}
                        if {event.progress.%{_killer}%} >= {event.goal}:
                            endEventWinner("Hedef kill sayısına ulaşıldı.", {_killer})

# ============================================
#  Block Break Race Mantığı (Towny)
# ============================================

on break of {@blockrace-block-type}:
    if {event.active} is true:
        if {event.type} = "blockrace":
            if player is in {event.players::*}:
                if world of player is world "{@towny-world}":

                    # --- TOWNY CLAIM KONTROLÜ ---
                    # Eğer claim içinde saymak istiyorsan ve SkTowny kullanıyorsan:
                    # options'ta blockrace-only-claims: true yap
                    if {@blockrace-only-claims} is true:
                        # AŞAĞIDAKİ SATIRI, KULLANDIĞIN TOWNY/skript ADDONUNA GÖRE DÜZENLEMELİSİN
                        # Örnek (SkTowny varsa):
                        # if town at location of player is not set:
                        #     stop
                        # Şimdilik hiçbir addon şart olmasın diye claim kontrolü boş bırakıldı.
                        wait 0 tick

                    add 1 to {event.progress.%player%}
                    send action bar "&dBlok: &e%{event.progress.%player%}% / {@blockrace-break-goal}" to player
                    if {event.progress.%player%} >= {event.goal}:
                        endEventWinner("Hedef blok sayısına ulaşıldı.", player)

# ============================================
#  Süre Dolma Kontrolü
# ============================================

every 10 seconds:
    if {event.active} is true:
        if {event.finish} is set:
            if {event.finish} is before now:
                endEventNoWinner("Süre doldu.")

Yapman Gereken Düzenlemeler

Dünya isimlerini ayarlamalısın. Kendi world isimlerini yaz.

Kod:
    boxpvp-world: "boxpvp_world"
    towny-world: "towny_world"

Towny claim kontrolü
Sadece claim içinde say istiyorsan: blockrace-only-claims: true yap
SkTowny gibi bir eklenti kullanıyorsan, şu kısmı kendi addon’un syntax’ına göre açıp düzenle:

Kod:
                    if {@blockrace-only-claims} is true:
                        # Örnek (SkTowny):
                        # if town at location of player is not set:
                        #     stop

Ödül komutları (tag / prefix / permission):

giveWinnerRewards fonksiyonundaki kısımlarını, kullandığın perms pluginine göre # kaldırıp düzenle.


Kod:
    # execute console command "lp user %name of {_p}% parent addtemp event_kazanan 1d"
    # execute console command "lp user %name of {_p}% meta setsuffix 1 &6[Event]&r"

Event başlayınca → otomatik title + actionbar
Oyuncu:

/event → GUI açılır, bilgi + “Katıl” butonu
/event join → klasik komutla katılma
Kill Race → BoxPvP dünyasında kill sayar
Block Race → Towny dünyasında stone kırınca sayar (claim kontrolü opsiyonel)
 
Kendi sunucuna ekledikten sonra hata verir ise bana ulaşırsan yardımıcı olurum
 
şimdi eklicem de event ödülü /crates key give (kazanan) event 2 komutu etkinleşşin
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Hala Discord sunucumuza katılmadın mı?

Büyük bir topluluğun parçası ol, etkinliklere katıl ve özel hediyeler kazanma şansı yakala!

Şimdi Katıl
Üst