Files
playtime.sk
Code
1 876
playtime.sk
# ============================================================
# PLAYTIME / OYNAMA SÜRESİ ÖDÜL SİSTEMİ
# Skript 2.12.2 - Minecraft 1.21.11
# Gereksinimler: Skript, Vault, EssentialsX
# ============================================================
options:
prefix: &8[&6Playtime&8] &r
gui-title: &8&lPLAYTIME ÖDÜLLERİ
auto-claim: false
afk-minutes: 5
weekly-target: 600
weekly-reward: 50000
reward-5m: 500
reward-15m: 1000
reward-30m: 2000
reward-1h: 5000
reward-2h: 7500
reward-3h: 10000
reward-5h: 15000
reward-10h: 25000
reward-15h: 35000
reward-25h: 50000
reward-50h: 100000
reward-100h: 250000
daily-30m: 1000
daily-1h: 2500
daily-2h: 5000
daily-4h: 10000
streak-1: 500
streak-3: 2000
streak-7: 10000
streak-14: 25000
# İsteğe bağlı komut ödülleri.
# Komutta __PLAYER__ yerine oyuncunun adı yazılır.
# Örnek: give __PLAYER__ iron_ingot 64
reward-5m-command: ""
reward-15m-command: ""
reward-30m-command: ""
reward-1h-command: ""
reward-2h-command: ""
reward-3h-command: ""
reward-5h-command: ""
reward-10h-command: ""
reward-15h-command: ""
reward-25h-command: ""
reward-50h-command: ""
reward-100h-command: ""
# ============================================================
# BAŞLANGIÇ
# ============================================================
on script load:
delete {playtime.reward.ids::*}
add 1 to {playtime.reward.ids::*}
add 2 to {playtime.reward.ids::*}
add 3 to {playtime.reward.ids::*}
add 4 to {playtime.reward.ids::*}
add 5 to {playtime.reward.ids::*}
add 6 to {playtime.reward.ids::*}
add 7 to {playtime.reward.ids::*}
add 8 to {playtime.reward.ids::*}
add 9 to {playtime.reward.ids::*}
add 10 to {playtime.reward.ids::*}
add 11 to {playtime.reward.ids::*}
add 12 to {playtime.reward.ids::*}
send "{@prefix}&aPlaytime sistemi yüklendi." to console
on join:
set {_id} to "%uuid of player%"
if {_id} is not in {playtime.players::*}:
add {_id} to {playtime.players::*}
set {playtime.name::%{_id}%} to name of player
if {playtime.total::%{_id}%} is not set:
set {playtime.total::%{_id}%} to 0
if {playtime.daily::%{_id}%} is not set:
set {playtime.daily::%{_id}%} to 0
if {playtime.weekly::%{_id}%} is not set:
set {playtime.weekly::%{_id}%} to 0
if {playtime.streak::%{_id}%} is not set:
set {playtime.streak::%{_id}%} to 0
set {playtime.last-activity::%{_id}%} to now
prepare-player(player)
on quit:
set {playtime.last-activity::%uuid of player%} to now
set {playtime.name::%uuid of player%} to name of player
# ============================================================
# AKTİVİTE VE AFK KONTROLÜ
# ============================================================
on player move:
set {playtime.last-activity::%uuid of player%} to now
on block break:
set {playtime.last-activity::%uuid of player%} to now
on block place:
set {playtime.last-activity::%uuid of player%} to now
on inventory click:
set {playtime.last-activity::%uuid of player%} to now
on consume:
set {playtime.last-activity::%uuid of player%} to now
on right click:
set {playtime.last-activity::%uuid of player%} to now
on chat:
set {playtime.last-activity::%uuid of player%} to now
# ============================================================
# ANA OYNAMA SÜRESİ SAYACI
# Her dakika yalnızca aktif oyuncular işlenir.
# ============================================================
every 1 minute:
loop all players:
set {_id} to "%uuid of loop-player%"
prepare-player(loop-player)
if {playtime.last-activity::%{_id}%} is not set:
set {playtime.last-activity::%{_id}%} to now
if difference between now and {playtime.last-activity::%{_id}%} is less than or equal to {@afk-minutes} minutes:
if {playtime.daily::%{_id}%} is 0:
set {playtime.last-active-day::%{_id}%} to now
if {playtime.streak::%{_id}%} is 0:
set {playtime.streak::%{_id}%} to 1
add 1 to {playtime.total::%{_id}%}
add 1 to {playtime.daily::%{_id}%}
add 1 to {playtime.weekly::%{_id}%}
apply-streak-rewards(loop-player)
apply-weekly-reward(loop-player)
if {@auto-claim} is true:
claim-all-ready-rewards(loop-player)
set {_next} to next-reward-index(loop-player)
if {_next} is set:
set {_needed} to reward-threshold({_next})
set {_current} to {playtime.total::%{_id}%}
if {_current} is greater than or equal to {_needed}:
send action bar "&6Playtime &8» &aBir ödülün hazır! &7/playtime" to loop-player
else:
set {_remaining} to {_needed} - {_current}
send action bar "&6Playtime &8» &eSonraki ödül: &a%format-minutes({_remaining})%" to loop-player
else:
send action bar "&6Playtime &8» &aTüm playtime ödüllerini tamamladın!" to loop-player
# ============================================================
# GÜN VE HAFTA HAZIRLIĞI
# ============================================================
function prepare-player(p: player):
set {_id} to "%uuid of {_p}%"
set {_today} to now formatted as "yyyy-MM-dd"
set {_week} to now formatted as "yyyy-ww"
if {playtime.day::%{_id}%} is not set:
set {playtime.day::%{_id}%} to {_today}
if {playtime.week::%{_id}%} is not set:
set {playtime.week::%{_id}%} to {_week}
if {playtime.day::%{_id}%} is not {_today}:
if {playtime.daily::%{_id}%} is greater than 0:
if {playtime.last-active-day::%{_id}%} is set:
if difference between now and {playtime.last-active-day::%{_id}%} is less than or equal to 2 days:
add 1 to {playtime.streak::%{_id}%}
else:
set {playtime.streak::%{_id}%} to 1
else:
set {playtime.streak::%{_id}%} to 1
else:
set {playtime.streak::%{_id}%} to 0
delete {playtime.streak-claimed::%{_id}%::*}
set {playtime.daily::%{_id}%} to 0
set {playtime.day::%{_id}%} to {_today}
if {playtime.week::%{_id}%} is not {_week}:
set {playtime.weekly::%{_id}%} to 0
delete {playtime.weekly-claimed::%{_id}%}
set {playtime.week::%{_id}%} to {_week}
# ============================================================
# FORMAT VE ÖDÜL BİLGİLERİ
# ============================================================
function format-minutes(minutes: number) :: text: