Problem with a gun 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

ForPlay_HD

Member
Aug 23, 2018
11
0
1
24
Hi, i've tried to make a gun skript, but when the player use left-click i want the system shoot 3 arrows, not 1.

code:
code_language.skript:
shoot arrow from player at speed 100

Sorry for my English, thanks xD
 
code_language.skript:
        loop 3 times:
            shoot arrow from player at speed 100

maybe this?
 
i've tried this, isn't working...
You should add a delay, for example:
code_language.skript:
        loop 3 times:
            if loop-number is not 1:
                wait 10 ticks
            shoot arrow from player at speed 100
 
Try

code_language.skript:
shoot arrow at speed 100

I leave you my gun skript, hope it helps you!

code_language.skript:
on right click using stone hoe:
    if the name of player's tool is coloured "Gun": #Check if the tool is a weapon
        cancel event
        set {_ammo} to uncolored 3rd line of the lore of the player's tool parsed as a number #set {_ammo} to the number at 3rd lore
        if player is sneaking:         #Process of reloading
            set {_result} to 10 - {_ammo}    #set {_result} to the difference between 10 (the max amount of ammo of the gun) to know how many bullets need to reload.
            set {_t} to the player's tool    #set {_t} to the actual weapon, for later check if the player doesnt change the tool.
            loop {_result} times:
                if player has 1 gold nugget named coloured "Ammo": #Gold nugget named "Ammo" is needed to reload
                    if player's tool is {_t}:   #Checking if the player is holding the weapon
                        wait 0.4 seconds           #This time is the time that takes reload 1 bullet.
                        if player's tool is {_t}: #before remove 1 bullet and add 1 to the gun, check again.
                            if the 3rd line of the lore of the player's tool isn't coloured "&710":  #prevent to over-reload bugs.
                                remove 1 gold nugget named coloured "Ammo" from player's inventory
                                add 1 to {_ammo}  #This total will be setting to the lore later
                                set the 3rd line of the lore of the player's tool to "&7%{_ammo}%" #updating the total of bullets
                                set {_t} to the player's tool           #update {_t} to the actual weapon, this is because 1 bullet was added to the gun.
                                send "&6Ammo: &7%{_ammo}%/10"
                        else:
                            exit loop
                else:
                    send "&cOut of ammo"
                    exit loop
            stop trigger
        else:       #Process of firing.
            if {_ammo} is less than 1:
                send "&cEmpty chamber" #Out of ammo
                stop
            if {FirerateTime::%player%} is not set:
                set {FirerateTime::%player%} to now
            set {_time} to difference between {FirerateTime::%player%} and now
            send "%{_time}%"
            if {_time} is more than 0.3 seconds: # 0.3 seg is the fire rate delay
                spawn snowball at player's head  #Note that the color is &c
                push last spawned snowball in direction of player at speed 3
                set the shooter of the last spawned snowball to the player
                remove 1 from {_ammo}
                set {FirerateTime::%player%} to now
                set the 3rd line of the lore of the player's tool to "&7%{_ammo}%"
 
Status
Not open for further replies.