Updated: lemme know if it needs more work:
Code:
on first join:
set {reports::%uuid of player%} to 0
set {warnings::%uuid of player%} to 0
command /warn [<player>] [<text>]:
permission: warnings.staff.perm
trigger:
if arg-1 is set:
if arg-2 is set:
broadcast "&c-----------------------------"
broadcast "&c| &l%arg-1%&r&c has been warned for &4%arg-2%. By %player%."
broadcast "&c-----------------------------"
add 1 to {warnings::%uuid of arg-1%}
if {warnings::%uuid of arg-1%} is 1:
set {warning1::%uuid of arg-1%} to arg-2
if {warnings::%uuid of arg-1%} is 2:
set {warning2::%uuid of arg-1%} to arg-2
if {warnings::%uuid of arg-1%} is 3:
set {warning3::%uuid of arg-1%} to arg-2
if {warnings::%uuid of arg-1%} is 4:
make console execute command "/tempban %arg-1% 3h"
every 1 month:
loop all players:
set {report1::%uuid of loop-player%} to 0
set {report2::%uuid of loop-player%} to 0
set {report3::%uuid of loop-player%} to 0
set {reports::%uuid of loop-player%} to 0
set {warnings::%uuid of loop-player%} to 0
set {warning1::%uuid of loop-player%} to 0
set {warning2::%uuid of loop-player%} to 0
set {warning3::%uuid of loop-player%} to 0
command /unwarn [<player>]:
permission: warnings.staff.perm
trigger:
if arg-1 is set:
broadcast "&a-----------------------------"
broadcast "&a| &l%arg-1%&r&a has been unwarned by &2&l%player%."
broadcast "&a-----------------------------"
if {warnings::%uuid of arg-1%} is 1:
delete {warning1::%uuid of arg-1%}
if {warnings::%uuid of arg-1%} is 2:
delete {warning2::%uuid of arg-1%}
if {warnings::%uuid of arg-1%} is 3:
delete {warning3::%uuid of arg-1%}
subtract 1 from {warnings::%uuid of arg-1%}
command /report [<player>] [<text>]:
trigger:
if arg-1 is set:
if arg-2 is set:
loop all players:
if loop-player has permission "warnings.staff.perm":
message "&c---------------------------" to loop-player
message "&c| &a%player% has reported %arg-1% for %arg-2%." to loop-player
message "&c---------------------------" to loop-player
add 1 to {reports::%uuid of arg-1%}
if {reports::%uuid of arg-1%} is 1:
set {report1::%uuid of arg-1%} to arg-2
if {reports::%uuid of arg-1%} is 2:
set {report2::%uuid of arg-1%} to arg-2
if {reports::%uuid of arg-1%} is 3:
set {report3::%uuid of arg-1%} to arg-2
command /unreport [<player>]:
permission: warnings.staff.perm
trigger:
if arg-1 is set:
if {reports::%uuid of arg-1%} is 1:
delete {report1::%uuid of arg-1%}
subtract 1 from {reports::%uuid of arg-1%}
if {reports::%uuid of arg-1%} is 2:
delete {report2::%uuid of arg-1%}
subtract 1 from {reports::%uuid of arg-1%}
if {reports::%uuid of arg-1%} is 3:
delete {report3::%uuid of arg-1%}
subtract 1 from {reports::%uuid of arg-1%}
command /staffchat <text>:
permission: warnings.staff.perm
aliases: /sc
trigger:
loop all players:
if loop-player has permission "warnings.staff.perm":
message "&7[&eStaffChat&7] &8>> &f%player%: %arg-1%" to loop-player
command /profile [<player>]:
permission: warnings.staff.perm
trigger:
if arg-1 is set:
if arg-1 is player:
message "&cYou can't profile yourself! dummy" to player
else if arg-1 isn't player:
set metadata tag "profile" of player to chest inventory with 3 rows named "&c%arg-1%'s Profile"
set slot 13 of metadata tag "profile" of player to arg-1's head named "&a%arg-1%"
if {reports::%uuid of arg-1%} is greater than 0:
set slot 12 of metadata tag "profile" of player to paper named "&cReports" with lore "&3-Reports:" and "%{reports::%uuid of arg-1%}%" and "&c1st Report: %{report1::%uuid of arg-1%}%" and "&c2nd Report: %{report2::%uuid of arg-1%}%" and "&c3rd Report: %{report3::%uuid of arg-1%}%"
else if {reports::%uuid of arg-1%} is 0:
set slot 12 of metadata tag "profile" of player to paper named "&aGood Child" with lore "&3-This player has 0 reports! :D"
if {warnings::%uuid of arg-1%} is greater than 0:
set slot 14 of metadata tag "profile" of player to paper named "&cWarns" with lore "&3-Warns:" and "%{warnings::%uuid of arg-1%}%" and "&c1st Warn: %{warning1::%uuid of arg-1%}%." and "&c2nd Warn: %{warning2::%uuid of arg-1%}%." and "&c3rd Warn: %{warning3::%uuid of arg-1%}%."
else if {warnings::%uuid of arg-1%} is 0:
set slot 14 of metadata tag "profile" of player to paper named "&aGood Child" with lore "&3-This player has 0 warnings! :D"
set slot 22 of metadata tag "profile" of player to barrier named "&cClose" with lore "&3-Click to close this menu!"
open (metadata tag "profile" of player) to player
on inventory click:
if event-inventory = (metadata tag "profile" of player):
cancel event
if index of event-slot is 22:
close player's inventory
hear me out. What if you make it so that instead of creating variables like
{warning1::%player's uuid%}, you make variables like
{warning::%player's uuid%::1}?
That way you can loop all of them and if you want to check them, you can do
if {warning::%player's uuid%::1} is set:
And if you want, you can add something like
{allwarnings::%player's uuid%}, and you can make the value of that variable the total of all of the warnings.
I didn't really look through the whole code, but from what I see, what you have works now, but maybe if you're planning on adding more features, you can consider doing that.
Also, I spotted an issue:
When you execute a console command "/tempban", you're assuming that the person using this skript has a "tempban" command.
What you can do instead is ban the player using Skript syntax (yes, banning is a built-in skript feature), and depending on what version you're using, you can easily temp-ban players like this:
Code:
(previous code)
ban and kick player due to (reason) for (timespan) # the 'due to' part is optional. The timespan part is too, but I'm assuming that's what you're looking for.
# The reason we kick the player is because banning the player just makes it so they can't rejoin.
Alright, I'm done yapping.