Skip to content

Instantly share code, notes, and snippets.

@bluelhf
Created September 14, 2019 17:07
Show Gist options
  • Save bluelhf/e15b45b1eecfadb76b60324b85ef42c0 to your computer and use it in GitHub Desktop.
Save bluelhf/e15b45b1eecfadb76b60324b85ef42c0 to your computer and use it in GitHub Desktop.
basic kit system for vanilla skript 2.4
command /kit [<text>]:
permission: kits.kit
trigger:
if arg-1 isn't set:
send "&6Kits: &e%all indices of {kitsystem.kits::*}%"
stop
set {_i::*} to all indices of {kitsystem.kits::*}
if {_i::*} doesn't contain uncoloured arg-1:
send "&cThat kit doesn't exist!"
stop
if unix timestamp of now < ({kitsystem.lastused::%uuid of player%::%arg-1%} ? 0) + {kitsystem.kits::%arg-1%::cooldown}:
player doesn't have permission "kits.cooldownbypass.%arg-1%"
set {_new-use-time} to "%(({kitsystem.lastused::%uuid of player%::%arg-1%} ? 0) + {kitsystem.kits::%arg-1%::cooldown}) - unix timestamp of now% seconds" parsed as timespan
send "&fYou need to wait &c%{_new-use-time}% &fbefore using this kit again."
stop
set {kitsystem.lastused::%uuid of player%::%arg-1%} to unix timestamp of now
loop integers from 0 to size of {kitsystem.kits::%arg-1%::*}-2:
set {_cmeta} to {kitsystem.kits::%arg-1%::%loop-value%::1}
set {_ctype} to {kitsystem.kits::%arg-1%::%loop-value%::2}
{_ctype}.setItemMeta({_cmeta})
give {_ctype} to player
send "&6Gave you the &e%arg-1% &6kit."
command /setkit <text> [<integer = 0>]:
description: Creates a kit with a name from your inventory
usage: /createkit <name> [cooldown in seconds]
permission: kits.createkit
trigger:
set {_c} to 0
set {kitsystem.kits::%arg-1%::cooldown} to arg-2
loop all items in player's inventory:
set {_cmeta} to (random item out of loop-value).getItemMeta()
set {_ctype} to (random item out of loop-value)
set {kitsystem.kits::%arg-1%::%{_c}%::1} to {_cmeta}
set {kitsystem.kits::%arg-1%::%{_c}%::2} to {_ctype}
add 1 to {_c}
send "&aKit &f%arg-1% &acreated."
command /deletekit <text>:
description: Deletes the kit with the given name
usage: /deletekit <name>
aliases: removekit, delkit, remkit
permission: kits.deletekit
trigger:
loop integers from 0 to size of {kitsystem.kits::%arg-1%::*}:
delete {kitsystem.kits::%arg-1%::%loop-value%::*}
delete {kitsystem.kits::%arg-1%::*}
delete {kitsystem.kits::%arg-1%}
send "&aIf kit &f%arg-1% &aexisted, it no longer does!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment