How to optimize this skript?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

KroterPvP

Active Member
Apr 10, 2017
178
7
18
22
Hello, I've created a new skript, but there are lots of sounds and the skript reloads within 2 minutes. I'm using SkQuerry, skript 2.2 benskus's edit 27-dev and Skellett.

The problem is that I'm using this sentence, and it doesn't allow me to set a variable to a number, and then set this variable in the item quantity (number 9 in this small code)
code_language.skript:
set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
How can I make the skript smaller, using loops and those things? Couse I can't because of the the sentence error :emoji_frowning:
code:
code_language.skript:
command /pistol:
    trigger:
        set {pistol.ammo.%player%} to 10
        set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
on rightclick:
    name of player's tool contains "&6Pistol &8»":
        cancel event
        if {pistol.ammo.%player%} is 0:
            send "&cOUT OF AMMO! &eRecharge!"
            play sound "BLAZE_HIT" to player with volume 1 and pitch 1
        else:
            if {pistol.recharging.%player%} is true:
                send "&cWait, your pistol is recharging"
            else:
                remove 1 from {pistol.ammo.%player%}
                shoot an arrow at speed 8
                if {pistol.ammo.%player%} is 9:
                    set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 8:
                    set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 7:
                    set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 6:
                    set slot 1 of player to 6 iron hoe named "&6Pistol &8» &6%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 5:
                    set slot 1 of player to 5 iron hoe named "&6Pistol &8» &6%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 4:
                    set slot 1 of player to 4 iron hoe named "&6Pistol &8» &c%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 3:
                    set slot 1 of player to 3 iron hoe named "&6Pistol &8» &c%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 2:
                    set slot 1 of player to 2 iron hoe named "&6Pistol &8» &4%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 1:
                    set slot 1 of player to 1 iron hoe named "&6Pistol &8» &4%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 0:
                    set slot 1 of player to 1 iron hoe named "&6Pistol &8» &4%{pistol.ammo.%player%}%"
                    play sound "BLAZE_HIT" to player with volume 1 and pitch 1
on leftclick:
    name of player's tool contains "&6Pistol &8»":
        cancel event
        if {pistol.ammo.%player%} is more than 10:
            set {pistol.ammo.%player%} to 10
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
        if {pistol.ammo.%player%} = 10:
            send "&aYour pistol is full charged! Kill them!"
        if {pistol.ammo.%player%} is 9:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 8:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 7:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 6:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 5:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 4:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 3:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 4 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 2:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 3 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 4 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 1:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 2 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 3 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 4 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 0:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 1 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 2 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 3 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 4 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
 
Hello, I've created a new skript, but there are lots of sounds and the skript reloads within 2 minutes. I'm using SkQuerry, skript 2.2 benskus's edit 27-dev and Skellett.

The problem is that I'm using this sentence, and it doesn't allow me to set a variable to a number, and then set this variable in the item quantity (number 9 in this small code)
code_language.skript:
set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
How can I make the skript smaller, using loops and those things? Couse I can't because of the the sentence error :emoji_frowning:
code:
code_language.skript:
command /pistol:
    trigger:
        set {pistol.ammo.%player%} to 10
        set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
on rightclick:
    name of player's tool contains "&6Pistol &8»":
        cancel event
        if {pistol.ammo.%player%} is 0:
            send "&cOUT OF AMMO! &eRecharge!"
            play sound "BLAZE_HIT" to player with volume 1 and pitch 1
        else:
            if {pistol.recharging.%player%} is true:
                send "&cWait, your pistol is recharging"
            else:
                remove 1 from {pistol.ammo.%player%}
                shoot an arrow at speed 8
                if {pistol.ammo.%player%} is 9:
                    set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 8:
                    set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 7:
                    set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 6:
                    set slot 1 of player to 6 iron hoe named "&6Pistol &8» &6%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 5:
                    set slot 1 of player to 5 iron hoe named "&6Pistol &8» &6%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 4:
                    set slot 1 of player to 4 iron hoe named "&6Pistol &8» &c%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 3:
                    set slot 1 of player to 3 iron hoe named "&6Pistol &8» &c%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 2:
                    set slot 1 of player to 2 iron hoe named "&6Pistol &8» &4%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 1:
                    set slot 1 of player to 1 iron hoe named "&6Pistol &8» &4%{pistol.ammo.%player%}%"
                if {pistol.ammo.%player%} is 0:
                    set slot 1 of player to 1 iron hoe named "&6Pistol &8» &4%{pistol.ammo.%player%}%"
                    play sound "BLAZE_HIT" to player with volume 1 and pitch 1
on leftclick:
    name of player's tool contains "&6Pistol &8»":
        cancel event
        if {pistol.ammo.%player%} is more than 10:
            set {pistol.ammo.%player%} to 10
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
        if {pistol.ammo.%player%} = 10:
            send "&aYour pistol is full charged! Kill them!"
        if {pistol.ammo.%player%} is 9:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 8:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 7:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 6:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 5:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 4:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 3:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 4 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 2:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 3 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 4 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 1:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 2 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 3 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 4 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
        if {pistol.ammo.%player%} is 0:
            set {pistol.recharging.%player%} to true
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 1 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 2 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 3 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 4 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 5 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 6 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 7 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 8 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 9 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            wait 0.5 seconds
            add 1 to {pistol.ammo.%player%}
            set slot 1 of player to 10 iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
            play sound "ITEM_PICKUP" to player with volume 1 and pitch 1
            set {pistol.recharging.%player%} to false
For the first part in the skript you could do this to make it a lot smaller:
code_language.skript:
                remove 1 from {pistol.ammo.%player%}
                shoot an arrow at speed 8
                If {pistol.ammo.%player%} is between 0 and 10:
                    set slot 1 of player to {pistol.ammo.%player%} iron hoe named "&6Pistol &8» &a%{pistol.ammo.%player%}%"
                If {pistol.ammo.%player%} = 0
                    play sound "BLAZE_HIT" to player with volume 1 and pitch 1
Otherwhise if you wanna use loops or need to you can do it like this:
code_language.skript:
                remove 1 from {pistol.ammo.%player%}
                shoot an arrow at speed 8
                Set {_timer} to 9
                Loop 9 times:
                    if {pistol.ammo.%player%} is {_timer}:
                        set slot 1 of player to {_timer} iron hoe named "&6Pistol &8» &a% {pistol.ammo.%player%}%"
                    Remove 1 from {_timer}

I hope you can make the other parts of the skript smaller yourself with this information :emoji_slight_smile: .
 
Last edited by a moderator: