Solved Hitting my self with the "shoot arrow" 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.

Davi3684

Member
Dec 29, 2017
15
0
0
21
Minecraft Version:1.8
---
Full Code:

code_language.skript:
on join:
    if {bc.rifle.%player%} is not set:
        set {bc.rifle.%player%} to 0
       
    if {bc.pistol.%player%} is not set:
        set {bc.pistol.%player%} to 0
       
command /getweapons:
    trigger:
       
        if {bc.rifle.%player%} is 0:    # Rifles
            set {bc.r0.ammo.%player%} to 16
            set {bc.r0.leftammo.%player%} to 64
            set {no.ammo.r0.%player%} to 0
            give a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%" to the player
           
        if {bc.pistol.%player%} is 0:    # Pistols
            set {bc.p0.ammo.%player%} to 8
            set {bc.p0.leftammo.%player%} to 64
            set {no.ammo.p0.%player%} to 0
            give a wooden shovel named "Pistol %{bc.p0.ammo.%player%}%/%{bc.p0.leftammo.%player%}%" to the player
           
           
        set {reloading.%player%} to 0
           
      
           
on left click:
    if player is holding a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%":
        if {no.ammo.r0.%player%} is 0:
            shoot arrow from player's head at speed 5
            set {bc.type.%last shot arrow%} to 1
       
       

            set {bc.r0.ammo.%player%} to {bc.r0.ammo.%player%} - 1 
            set the name of the player's tool to "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%"
           
            if {bc.r0.ammo.%player%} is 0:
                if {bc.r0.leftammo.%player%} is 0:
                    set {no.ammo.r0.%player%} to 1
                    set {reloading.%player%} to 0
                else:
                    set {reloading.%player%} to true
                    message "Reloading" 
                    set the name of the player's tool to "Reloading..."
                    wait 20 ticks
                    set the name of the player's tool to "Reloading.."
                    wait 20 ticks
                    set the name of the player's tool to "Reloading."
                    wait 20 ticks
                    set {bc.r0.leftammo.%player%} to {bc.r0.leftammo.%player%} - 16
                    set {bc.r0.ammo.%player%} to 16
                    set the name of the player's tool to "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%"
                    set {reloading.%player%} to 0
           
            wait 8 ticks
        else:
            message "Out of ammo"
           

           
    if player is holding a wooden shovel named "Pistol %{bc.p0.ammo.%player%}%/%{bc.p0.leftammo.%player%}%":
        if {no.ammo.p0.%player%} is 0:
            shoot arrow from player's head at speed 3
            set {bc.type.%last shot arrow%} to 1.5
       
       

            set {bc.p0.ammo.%player%} to {bc.p0.ammo.%player%} - 1 
            set the name of the player's tool to "Pistol %{bc.p0.ammo.%player%}%/%{bc.p0.leftammo.%player%}%"
           
            if {bc.p0.ammo.%player%} is 0:
                if {bc.p0.leftammo.%player%} is 0:
                    set {no.ammo.p0.%player%} to 1
                    set {reloading.%player%} to 0
                else:
                    set {reloading.%player%} to true
                    message "Reloading" 
                    set the name of the player's tool to "Reloading..."
                    wait 20 ticks
                    set the name of the player's tool to "Reloading.."
                    wait 20 ticks
                    set the name of the player's tool to "Reloading."
                    wait 20 ticks
                    set {bc.p0.leftammo.%player%} to {bc.p0.leftammo.%player%} - 8
                    set {bc.p0.ammo.%player%} to 8
                    set the name of the player's tool to "Pistol %{bc.p0.ammo.%player%}%/%{bc.p0.leftammo.%player%}%"
                    set {reloading.%player%} to 0
           
            wait 50 ticks
        else:
            message "Out of ammo"
           

on damage:
   
    projectile is a arrow
    if {bc.type.%projectile%} is a number:
        set damage to {bc.type.%projectile%}
       
on tool change:
    if {reloading.%player%} is true:
        cancel event

So, when I use the "shoot arrow from player's head" it hits me. and I'm looking for a way to make it spawn 1 block in front of the player, but everything I try doesn't seem to work.

Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
 
Try just using
code_language.skript:
shoot arrow from player at speed 2
 
Status
Not open for further replies.