Kod:
# Default options to use with .yml configuration
options:
prefix: &e&lYAKALAMACA &8» &r
should_send_info: true
money_reward: 1
chicken_spawn_radius: 25
chicken_count: 5
chicken_lifespan: 3
load_message: &7&nScript yüklendi!
unload_message: &7&nScript devre dışı!
no_spawn_message: &cEtkinlik başlangıç noktası bulunamadı! &f/yakalamaca başlangıç belirle
set_spawn_message: &cEtkinlik başlangıç noktasi belirlendi!
teleport_spawn_message: &7Başlangıç noktasına ışınlandın.
event_started_message: &9Etkinlik başladı!
event_spawned_chicken: &6Bir tavuk doğdu!
event_dead_chicken: &6Tavuk öldürüldü!
event_ended: &fEtkinlik bitmiştir, katılanlara teşekkür iletiyoruz.
# Set spawn function
function setSpawn(p: player):
set {vars::spawnloc} to location of {_p}
send "%{globals:refix}%%{globals::set_spawn_message}%" to {_p}
# Spawn chicken function
function spawnChicken():
set {_block} to a random element of blocks in radius {globals::chicken_spawn_radius} of {vars::spawnloc}
while ({_block} is not air): # Not a good practice but couldn't find another way
set {_block} to a random element of blocks in radius {globals::chicken_spawn_radius} of {vars::spawnloc}
set y-coordinate of {_block} to y-coordinate of {vars::spawnloc} + 5
spawn a chicken at {_block}
set {_chicken} to the last spawned chicken
set name of {_chicken} to "&0‰"
broadcast "%{globals:refix}%%{globals::event_spawned_chicken}%"
# Chicken death event
on death of a chicken:
if {priv::started} is set:
if name of victim is "&0‰":
if attacker is a player:
broadcast "%{globals:refix}%%{globals::event_dead_chicken}%"
add {globals::money_reward} to balance of attacker
if {vars::chicken_count} is greater than 0:
remove 1 from {vars::chicken_count}
spawnChicken()
else:
delete {priv::started}
broadcast "%{globals:refix}%%{globals::event_ended}%"
# Main command
command /yakalamaca [<text>] [<text>]:
permission: op
trigger:
if arg-1 is "başlangıç":
if arg-2 is "belirle":
setSpawn(player)
if arg-2 is "ışınlan":
if {vars::spawnloc} is set:
teleport player to {vars::spawnloc}
send "%{globals:refix}%%{globals::teleport_spawn_message}%"
else:
send "%{globals:refix}%%{globals::no_spawn_message}%"
if arg-1 is "başlat":
if {vars::spawnloc} is not set:
send "%{globals:refix}%%{globals::no_spawn_message}%"
stop
set {priv::started} to true
broadcast "%{globals:refix}%%{globals::event_started_message}%"
set {vars::chicken_count} to {globals::chicken_count} - 1
if {vars::chicken_count} is lower than 1:
set {vars::chicken_count} to 1
spawnChicken()
if arg-1 is "bitir":
delete {priv::started}
delete {vars::chicken_count}
broadcast "%{globals:refix}%%{globals::event_ended}%"
# Tab completion
on tab complete of "/yakalamaca":
set tab completions for position 1 to "başlat", "bitir" and "başlangıç"
if tab arg-1 is "başlangıç":
set tab completions for position 2 to "belirle" and "ışınlan"
# Load config function
function loadConfig():
load yml "plugins/Skript/scripts/yakalamaca/ayarlar.yml"
# Prefix
if yml path "ayarlar.ön-ek" in "ayarlar" doesn't exist:
set yml value "ayarlar.ön-ek" from "ayarlar" to "{@prefix}"
# Info messages
if yml path "ayarlar.bilgi-mesajları" in "ayarlar" doesn't exist:
set yml value "ayarlar.bilgi-mesajları" from "ayarlar" to "{@should_send_info}"
# Money reward
if yml path "ayarlar.para-ödülü" in "ayarlar" doesn't exist:
set yml value "ayarlar.para-ödülü" from "ayarlar" to "{@money_reward}"
# Tavuk doğma alanı
if yml path "ayarlar.tavuk-doğma-alanı" in "ayarlar" doesn't exist:
set yml value "ayarlar.tavuk-doğma-alanı" from "ayarlar" to "{@chicken_spawn_radius}"
# Chicken count
if yml path "ayarlar.etkinlik-tavuk-sayısı" in "ayarlar" doesn't exist:
set yml value "ayarlar.etkinlik-tavuk-sayısı" from "ayarlar" to "{@chicken_count}"
# Chicken lifespan
if yml path "ayarlar.etkinlik-tavuk-ömrü" in "ayarlar" doesn't exist:
set yml value "ayarlar.etkinlik-tavuk-ömrü" from "ayarlar" to "{@chicken_lifespan}"
# Load message
if yml path "ayarlar.yüklenme-mesajı" in "ayarlar" doesn't exist:
set yml value "ayarlar.yüklenme-mesajı" from "ayarlar" to "{@load_message}"
# Unload message
if yml path "ayarlar.devre-dışı-mesajı" in "ayarlar" doesn't exist:
set yml value "ayarlar.devre-dışı-mesajı" from "ayarlar" to "{@unload_message}"
# No spawnpoint message
if yml path "ayarlar.başlangıç-yok-mesajı" in "ayarlar" doesn't exist:
set yml value "ayarlar.başlangıç-yok-mesajı" from "ayarlar" to "{@no_spawn_message}"
# Set spawnpoint message
if yml path "ayarlar.başlangıç-belirlendi-mesajı" in "ayarlar" doesn't exist:
set yml value "ayarlar.başlangıç-belirlendi-mesajı" from "ayarlar" to "{@set_spawn_message}"
# Teleported spawnpoint message
if yml path "ayarlar.başlangıç-ışınlanıldı-mesajı" in "ayarlar" doesn't exist:
set yml value "ayarlar.başlangıç-ışınlanıldı-mesajı" from "ayarlar" to "{@teleport_spawn_message}"
# Event started message
if yml path "ayarlar.etkinlik-başladı-mesajı" in "ayarlar" doesn't exist:
set yml value "ayarlar.etkinlik-başladı-mesajı" from "ayarlar" to "{@event_started_message}"
# Event chicken spawned
if yml path "ayarlar.etkinlik-tavuk-doğdu" in "ayarlar" doesn't exist:
set yml value "ayarlar.etkinlik-tavuk-doğdu" from "ayarlar" to "{@event_spawned_chicken}"
# Event chicken dead
if yml path "ayarlar.etkinlik-tavuk-öldü" in "ayarlar" doesn't exist:
set yml value "ayarlar.etkinlik-tavuk-öldü" from "ayarlar" to "{@event_dead_chicken}"
# Event ended
if yml path "ayarlar.etkinlik-bitti" in "ayarlar" doesn't exist:
set yml value "ayarlar.etkinlik-bitti" from "ayarlar" to "{@event_ended}"
save yml "ayarlar"
set {globals:refix} to yml value "ayarlar.ön-ek" from "ayarlar"
set {globals::should_send_info} to yml value "ayarlar.bilgi-mesajları" in "ayarlar"
set {globals::money_reward} to yml value "ayarlar.para-ödülü" in "ayarlar"
set {globals::chicken_spawn_radius} to yml value "ayarlar.tavuk-doğma-alanı" in "ayarlar"
set {globals::chicken_count} to yml value "ayarlar.etkinlik-tavuk-sayısı" in "ayarlar"
set {globals::chicken_lifespan} to yml value "ayarlar.etkinlik-tavuk-ömrü" in "ayarlar"
set {globals::load_message} to yml value "ayarlar.yüklenme-mesajı" from "ayarlar"
set {globals::unload_message} to yml value "ayarlar.devre-dışı-mesajı" from "ayarlar"
set {globals::no_spawn_message} to yml value "ayarlar.başlangıç-yok-mesajı" from "ayarlar"
set {globals::set_spawn_message} to yml value "ayarlar.başlangıç-belirlendi-mesajı" from "ayarlar"
set {globals::teleport_spawn_message} to yml value "ayarlar.başlangıç-ışınlanıldı-mesajı" from "ayarlar"
set {globals::event_started_message} to yml value "ayarlar.etkinlik-başladı-mesajı" from "ayarlar"
set {globals::event_spawned_chicken} to yml value "ayarlar.etkinlik-tavuk-doğdu" from "ayarlar"
set {globals::event_dead_chicken} to yml value "ayarlar.etkinlik-tavuk-öldü" from "ayarlar"
set {globals::event_ended} to yml value "ayarlar.etkinlik-bitti" from "ayarlar"
# On load handler to setup script
on load:
loadConfig()
if {globals::should_send_info} is true:
send "%{globals:refix}%%{globals::load_message}%" to console
# On unload handler to collect garbage & save
on unload:
delete {priv::started}
delete {vars::chicken_count}
if {globals::should_send_info} is true:
send "%{globals:refix}%%{globals::unload_message}%" to console
# six#6186
Moderatör tarafında düzenlendi: