Skript Version (do not put latest): Skript 2.4.1
Skript Author: Bensku
Minecraft Version: 1.12.2
Server Spigot 1.12.2
How I try to fix the code
I did everything else widout the function and it was working great, but doing this widout a function it will be messy and will take more time
Skript Author: Bensku
Minecraft Version: 1.12.2
Server Spigot 1.12.2
Code:
On load:
set {M1911} to a Iron horse armor named "M1911"
Function guns(p: player, v: entity):
if {_p} is holding {M1911}:
if the distance between the {_p} and {_v} is less than 10:
set {vida.%{_v}%} to {vida.%{_v}%} - 12.5
message "12.5" to {_p}
message "%{vida.%{_v}%}%" to {_p}
else if the distance between the {_p} and {_v} is more than 10:
set {vida.%{_v}%} to {vida.%{_v}%} - 6.25
on rightclick:
player is holding {M1911}
make the player shoot an snowball at speed 2
command /gun:
trigger:
give {M1911} to the player
on damage of a zombie:
if {vida.%victim%} is set:
damage was caused by lava, fire or burning
cancel event
stop
if {vida.%victim%} is set:
cancel event
attacker is a player
guns(attacker, victim)
if {vida.%victim%} is less than or equal to 0:
kill victim
command /test:
trigger:
spawn a zombie 1 meter above the player
add 1 to {z_count}
set {zombie::%{z_count}%} to last spawned entity
set {vida.%{zombie::%{z_count}%}%} to 100
Variables cannot be used here. (zombies.sk, line 8: if the distance between the {_p} and {_v} is less than 10:')
[18:47:23 ERROR]: 'else if' has to be placed just after another 'if' or 'else if' section (zombies.sk, line 12: else if the distance between the {_p} and {_v} is more than 10:')
[18:47:23 ERROR]: 'else if' has to be placed just after another 'if' or 'else if' section (zombies.sk, line 12: else if the distance between the {_p} and {_v} is more than 10:')
How I try to fix the code
I did everything else widout the function and it was working great, but doing this widout a function it will be messy and will take more time