c4.sk

Created by Unknown

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

#    ____    _  _
#   / ___|  | || |
#  | |      | || |_
#  | |___   |__   _|
#   \____|     |_|

#  --  Have a little more fun with explosions.

options:
    version: 1.3 # <--DO NOT edit version number

# -- DO NOT EDIT BELOW THIS LINE OR SUPPORT WILL BE LOST -- #

# --- Loading Recipes --- #

on load:
    set {_detonator} to 1 book named "&9Detonator"
    set 1st line of lore of {_detonator} to "BOOM TIME - 3 Charges"
    set 2nd line of lore of {_detonator} to "&2Set your C4 charges"
    set 3rd line of lore of {_detonator} to "&cRight click to detonate charges"
    register new shaped recipe for {_detonator} using emerald, emerald, emerald, book, book, book, redstone, redstone, redstone
    set {_c4} to 3 head named "&cC4"
    set 1st line of lore of {_c4} to "&cSet upto 3 charges"
    set 2nd line of lore of {_c4} to "&2Use your detonator to"
    set 3rd line of lore of {_c4} to "&2detonate your charges"
    register new shaped recipe for {_c4} using paper, paper, paper, tnt, head, tnt, paper, paper, paper
    set {_grenade} to 1 poisonous potato named "&9Grenade"
    set 1st line of lore of {_grenade} to "&bRight-Click to throw grenade"
    register new shaped recipe for {_grenade} using air, air, air, redstone, poisonous potato, tnt, air, air, air
    set {_grenade.stun} to 1 poisonous potato named "&9Stun Grenade"
    set 1st line of lore of {_grenade.stun} to "&bRight-Click to throw stun grenade"
    register new shaped recipe for {_grenade.stun} using air, air, air, redstone, poisonous potato, tnt, cactus, cactus, cactus

# --- Loading Version --- #

on load:
	send "[&bC4&r] - &2Loaded Successfully" to console
	if text from "https://pastebin.com/raw/dnSjnhDQ" is not "{@version}":
		set {_version} to text from "https://pastebin.com/raw/dnSjnhDQ"
		send "[&bC4&r] - &2Running current version: {@version}" to console
		send "[&bC4&r] - &cUpdate available, version: %{_version}%" to console
	if text from "https://pastebin.com/raw/dnSjnhDQ" is "{@version}":
		send "[&bC4&r] - &2Running current version: {@version}" to console

on join:
	wait 1 second
	if player has permission "c4.admin":
		if text from "https://pastebin.com/raw/dnSjnhDQ" is not "{@version}":
			set {_version} to text from "https://pastebin.com/raw/dnSjnhDQ"
			send "[&bC4&r] - &2Running current version: {@version}" to player
			send "[&bC4&r] - &cUpdate available, version: %{_version}%" to player

# --- Crafting Permissions --- #

on craft of poisonous potato:
	if name of item is "&9Grenade":
		if player does not have permission "c4.craft.grenade":
			cancel event
			send "[&bC4&r] - &cYou do not have permission to craft grenades" to player

on craft of poisonous potato:
    if name of item is "&9Stun Grenade":
        if player does not have permission "c4.craft.stungrenade":
            cancel event
            send "[&bC4&r] - &cYou do not have permission to craft stun grenades" to player

on craft of book:
	if name of item is "&9Detonator":
		if player does not have permission "c4.craft.detonator":
			cancel event
			send "[&bC4&r] - &cYou do not have permission to craft grenades" to player

on craft of head:
	if name of item is "&cC4":
		if player does not have permission "c4.craft.charges":
			cancel event
			send "[&bC4&r] - &cYou do not have permission to craft grenades" to player

# --- Commands --- #

command /c4 [<text>]:
    trigger:
        if player has permission "c4.admin":
            if arg-1 is not set:
                send "[&bC4&r] &c/c4 detonator &r- Receive 1 detonator" to player
                send "[&bC4&r] &c/c4 charges &r- Receive 3 charges" to player
                send "[&bC4&r] &c/grenade <number> &r- Receive grenades" to player
                send "[&bC4&r] &c/stungrenade <number> &r- Receive stun grenades" to player
            if arg-1 is "detonator":
                set {_detonator} to 1 book named "&9Detonator"
                set 1st line of lore of {_detonator} to "BOOM TIME - 3 Charges"
                set 2nd line of lore of {_detonator} to "&2Set your C4 charges"
                set 3rd line of lore of {_detonator} to "&cRight click to detonate charges"
                give player 1 of {_detonator}
            if arg-1 is "charges":
                set {_c4} to 1 head named "&cC4"
                set 1st line of lore of {_c4} to "&cSet upto 3 charges"
                set 2nd line of lore of {_c4} to "&2Use your detonator to"
                set 3rd line of lore of {_c4} to "&2detonate your charges"
                give player 3 of {_c4}
        if player does not have permission "c4.admin":
            send "[&9C4&r] - &cYou do not have permission for this command" to player

# -----C4----- #

# --- Setting Charges --- #

on right-click holding a head:
    if name of player's tool is "&cC4":
        if player is not sneaking:
            if block at event-location is not air:
                if {explode.%player%.1} is not set:
                    set {explode.%player%.1} to location at event-location
                    send "&c[C4] &2##1 &rplaced at %{explode.%player%.1}%" to player
                    stop
                else if {explode.%player%.2} is not set:
                    set {explode.%player%.2} to location at event-location
                    send "&c[C4] &2##2 &rplaced at %{explode.%player%.2}%" to player
                    stop
                else if {explode.%player%.3} is not set:
                    set {explode.%player%.3} to location at event-location
                    send "&c[C4]&2 ##3 &rplaced at %{explode.%player%.3}%" to player
                    stop
                else:
                    cancel event
                    send "&c[C4] &4All placed, use your detonator to detonate charges"
        if player is sneaking:
            if {explode.%player%.1} is not set:
                cancel event
                set {c4shoot.%player%} to true
                make the player shoot a snowball at speed 2
                remove 1 of item from player's inventory
                stop
            else if {explode.%player%.2} is not set:
                cancel event
                set {c4shoot.%player%} to true
                make the player shoot a snowball at speed 2
                remove 1 of item from player's inventory
                stop
            else if {explode.%player%.3} is not set:
                cancel event
                set {c4shoot.%player%} to true
                make the player shoot a snowball at speed 2
                remove 1 of item from player's inventory
                stop
            else:
                cancel event
                send "&c[C4] &4All placed, use your detonator to detonate charges"

on projectile hit:
    if projectile is a snowball:
        if {c4shoot.%shooter%} is true:
            if {explode.%shooter%.1} is not set:
                set {explode.%shooter%.1} to location at event-location
                set block at event-location to head
                send "&c[C4] &2##1 &rplaced at %{explode.%shooter%.1}%" to shooter
                set {c4shoot.%shooter%} to false
                stop
            if {explode.%shooter%.2} is not set:
                set {explode.%shooter%.2} to location at event-location
                set block at event-location to head
                send "&c[C4] &2##1 &rplaced at %{explode.%shooter%.2}%" to shooter
                set {c4shoot.%shooter%} to false
                stop
            if {explode.%shooter%.3} is not set:
                set {explode.%shooter%.3} to location at event-location
                set block at event-location to head
                send "&c[C4] &2##1 &rplaced at %{explode.%shooter%.3}%" to shooter
                set {c4shoot.%shooter%} to false
                stop

# --- Detonating Charges --- #

on right-click holding a book:
    if name of player's tool contains "&9Detonator":
        if {explode.%player%.1} is set:
            send "&c[C4]: &2&lBOOM TIME" to player
            wait 2 seconds
            create an explosion of force 7 at location of {explode.%player%.1}
            wait 3 ticks
            create an explosion of force 7 at location of {explode.%player%.2}
            wait 3 ticks
            create an explosion of force 7 at location of {explode.%player%.3}
            delete {explode.%player%.1}
            delete {explode.%player%.2}
            delete {explode.%player%.3}
        else:
            send "&c[C4]: &4&lYou have no charges set."

# -----Grenades----- #

command /grenade <number>:
    trigger:
        if player has permission "c4.admin":
            set {_grenade} to 1 poisonous potato named "&9Grenade" with lore "&bRight-Click to throw grenade"
            give player arg-1 of {_grenade}

on projectile hit:
    if projectile is a snowball:
        if {kaboom.%shooter%} is true:
            wait 1 second
            create an explosion of force 7 at location of event-location
            set {kaboom.%shooter%} to false

on right-click:
    player's tool is a poisonous potato named "&9Grenade" with lore "&bRight-Click to throw grenade"
    cancel event
    make the player shoot a snowball at speed 2
    set {kaboom.%player%} to true
    remove 1 of item from player's inventory

# ----- Stun Grenades ----- #

command /stungrenade <number>:
    trigger:
        if player has permission "c4.admin":
            set {_stungrenade} to 1 poisonous potato named "&9Stun Grenade" with lore "&bRight-Click to throw stun grenade"
            give player arg-1 of {_stungrenade}

on right-click:
    player's tool is a poisonous potato named "&9Stun Grenade" with lore "&bRight-Click to throw stun grenade"
    cancel event
    make the player shoot a snowball at speed 2
    set {stungrenade.%player%} to true
    remove 1 of item from player's inventory

on projectile hit:
    if projectile is a snowball:
        if {stungrenade.%shooter%} is true:
            wait 1 second
            detonate trailing ball firework colored white at location 2 above event-location
            detonate trailing ball firework colored white at location 2 above and 3 north of event-location
            detonate trailing ball firework colored white at location 2 above and 3 south of event-location
            detonate trailing ball firework colored white at location 2 above and 3 east of event-location
            detonate trailing ball firework colored white at location 2 above and 3 west of event-location
            wait 10 ticks
            detonate trailing ball firework colored white at location 2 above event-location
            detonate trailing ball firework colored white at location 2 above and 3 north of event-location
            detonate trailing ball firework colored white at location 2 above and 3 south of event-location
            detonate trailing ball firework colored white at location 2 above and 3 east of event-location
            detonate trailing ball firework colored white at location 2 above and 3 west of event-location
            set {stungrenade.%shooter%} to false
            loop players in radius 8 around event-location:
                apply blindness to loop-player for 5 seconds
                apply nausea to loop-player for 7 seconds
                damage loop-player by 1 heart