Files
README.txt
staffmode.sk
Code
2 181
staffmode.sk
# StaffMode Script
# Place in plugins/Skript/scripts/
# Reload with: /sk reload staffmode
options:
prefix: &8[&bStaff&8]&r
permission: staff.mode
# {staffmode.active::%uuid%} = true/false
# {staffmode.inv.%uuid%.%slot%} = saved item per slot
on script load:
send "{@prefix} &aStaffMode script loaded!" to console
# ─────────────────────────────────────────
# FUNCTIONS
# ─────────────────────────────────────────
function staffEnable(p: player):
set {staffmode.active::%uuid of {_p}%} to true
# Save inventory
loop 36 times:
set {staffmode.inv.%uuid of {_p}%.%loop-number - 1%} to slot (loop-number - 1) of {_p}'s inventory
set {staffmode.inv.%uuid of {_p}%.helmet} to {_p}'s helmet
set {staffmode.inv.%uuid of {_p}%.chestplate} to {_p}'s chestplate
set {staffmode.inv.%uuid of {_p}%.leggings} to {_p}'s leggings
set {staffmode.inv.%uuid of {_p}%.boots} to {_p}'s boots
# Clear inventory and armor
clear {_p}'s inventory
set {_p}'s helmet to air
set {_p}'s chestplate to air
set {_p}'s leggings to air
set {_p}'s boots to air
# Give ban dyes
set slot 0 of {_p}'s inventory to red dye named "&c&lHacks &7(30d Ban)"
set slot 1 of {_p}'s inventory to orange dye named "&6&lFly Hacks &7(30d Ban)"
set slot 2 of {_p}'s inventory to yellow dye named "&e&lReach &7(30d Ban)"
set slot 3 of {_p}'s inventory to lime dye named "&a&lKillAura &7(30d Ban)"
set slot 4 of {_p}'s inventory to cyan dye named "&b&lAutoClicker &7(30d Ban)"
set slot 5 of {_p}'s inventory to light blue dye named "&3&lScaffold &7(30d Ban)"
set slot 6 of {_p}'s inventory to purple dye named "&5&lSpeed &7(30d Ban)"
set slot 7 of {_p}'s inventory to pink dye named "&d&lAntiKB &7(30d Ban)"
set slot 8 of {_p}'s inventory to white dye named "&f&lExit Staff Mode"
# Vanish from non-staff
loop all players:
if loop-player does not have permission "{@permission}":
hide {_p} from loop-player
send "{@prefix} &aStaff mode &2enabled&a. You are now vanished." to {_p}
function staffDisable(p: player):
set {staffmode.active::%uuid of {_p}%} to false
# Restore inventory
clear {_p}'s inventory
loop 36 times:
set slot (loop-number - 1) of {_p}'s inventory to {staffmode.inv.%uuid of {_p}%.%loop-number - 1%}
delete {staffmode.inv.%uuid of {_p}%.%loop-number - 1%}
set {_p}'s helmet to {staffmode.inv.%uuid of {_p}%.helmet}
set {_p}'s chestplate to {staffmode.inv.%uuid of {_p}%.chestplate}
set {_p}'s leggings to {staffmode.inv.%uuid of {_p}%.leggings}
set {_p}'s boots to {staffmode.inv.%uuid of {_p}%.boots}
delete {staffmode.inv.%uuid of {_p}%.helmet}
delete {staffmode.inv.%uuid of {_p}%.chestplate}
delete {staffmode.inv.%uuid of {_p}%.leggings}
delete {staffmode.inv.%uuid of {_p}%.boots}
# Unvanish
loop all players:
show {_p} to loop-player
send "{@prefix} &cStaff mode &4disabled&c. Inventory restored." to {_p}
# ─────────────────────────────────────────
# COMMAND
# ─────────────────────────────────────────
command /staffmode:
permission: {@permission}
permission message: &cYou don't have permission to use staff mode.
trigger:
if {staffmode.active::%uuid of player%} is true:
staffDisable(player)
else:
staffEnable(player)
# ─────────────────────────────────────────
# BAN DYE INTERACTION
# ─────────────────────────────────────────
on right click:
if {staffmode.active::%uuid of player%} is not true:
stop
if clicked entity is not a player:
stop
set {_name} to name of player's held item
if {_name} is "&f&lExit Staff Mode":
staffDisable(player)
stop
set {_reason} to ""
if {_name} is "&c&lHacks &7(30d Ban)":
set {_reason} to "Hacks"
if {_name} is "&6&lFly Hacks &7(30d Ban)":
set {_reason} to "Fly Hacks"
if {_name} is "&e&lReach &7(30d Ban)":
set {_reason} to "Reach"
if {_name} is "&a&lKillAura &7(30d Ban)":
set {_reason} to "KillAura"
if {_name} is "&b&lAutoClicker &7(30d Ban)":
set {_reason} to "AutoClicker"
if {_name} is "&3&lScaffold &7(30d Ban)":
set {_reason} to "Scaffold"
if {_name} is "&5&lSpeed &7(30d Ban)":
set {_reason} to "Speed"
if {_name} is "&d&lAntiKB &7(30d Ban)":
set {_reason} to "AntiKB"
if {_reason} is "":
stop
set {_target} to clicked entity
if {_target} has permission "{@permission}":
send "{@prefix} &cYou cannot ban another staff member." to player
stop
send "{@prefix} &eBanning &f%name of {_target}% &efor &c30 days &efor &f%{_reason}%&e..." to player
execute console command "tempban %name of {_target}% 30d [StaffMode] %{_reason}%"
broadcast "{@prefix} &f%name of {_target}% &chas been banned for &730 days &cby &f%player% &cfor &7%{_reason}%&c."
# ─────────────────────────────────────────
# KEEP STAFF HIDDEN ON JOIN
# ─────────────────────────────────────────
on join:
loop all players:
if {staffmode.active::%uuid of loop-player%} is true:
if player does not have permission "{@permission}":
hide loop-player from player
# ─────────────────────────────────────────
# AUTO DISABLE ON QUIT (safety)
# ─────────────────────────────────────────
on quit:
if {staffmode.active::%uuid of player%} is true:
staffDisable(player)