Files
keyall.sk
Code
1 55
keyall.sk
# KeyAll System - Timer Based
# Automatically activates every X minutes
# Gives random keys to all online players
# DonutSMP KeyAll style
# Created by Sky
options:
prefix: &6[&eKeyAll&6]&r
timer_interval_minutes: 30
key_list: "booster, star_light, panda_key, crocodile, steampunk, demon_king, demon_lord, necros, nano, cardael, pirate, dragonsoul, valentine, aurion, frostbite, frost, mystic, arcane, fire"
on script load:
set {keyall_active} to false
set {keyall_keys::*} to {@key_list} split at ", "
broadcast "{@prefix} &aKeyAll system loaded! Giveaways every {@timer_interval_minutes} minutes."
function keyall_sky() :: text:
return "Next in {@timer_interval_minutes} minutes"
every {@timer_interval_minutes} minutes:
set {keyall_active} to true
loop all players:
if loop-player is online:
set {_random_key} to a random element out of {keyall_keys::*}
execute console command "/crates key give %loop-player% %{_random_key}% 1"
send action bar "&6KeyAll &7» &aYou received a random key!" to all players
play sound "entity.player.levelup" with volume 1 and pitch 1 to all players
set {keyall_active} to false
command /keyall [<text>]:
permission: keyall.admin
trigger:
if arg-1 is not set:
send "{@prefix} &cUsage: /keyall <status|reset|forcegive>"
stop
if arg-1 is "status":
send "{@prefix} &eActive: %{keyall_active}%"
else if arg-1 is "reset":
set {keyall_active} to false
broadcast "{@prefix} &cKeyAll reset by admin. Next giveaway in {@timer_interval_minutes} minutes."
else if arg-1 is "forcegive":
if {keyall_active} is true:
send "{@prefix} &cKeyAll is already active!"
stop
set {keyall_active} to true
loop all players:
if loop-player is online:
set {_random_key} to a random element out of {keyall_keys::*}
execute console command "/crates key give %loop-player% %{_random_key}% 1"
send action bar "&6KeyAll &7» &aYou received a random key!" to all players
play sound "entity.player.levelup" with volume 1 and pitch 1 to all players
set {keyall_active} to false
broadcast "{@prefix} &aForced KeyAll giveaway activated!"
else:
send "{@prefix} &cInvalid subcommand!"