I'm having troubles when getting the attacker in my skript. I will explain it a bit. The script spawns a primed tnt and sometimes the player gets killed by it. The problem is that skript doesn't know who was the person who killed the player (I'm trying to know who placed the tnt storing it in a variable but I can't do it).
- No console errors.
- Skript 2.2 Bensku dev24, SkRayFall, QkQuery, Skellet (I'm using them for other skripts, not for this one).
Thanks
code_language.skript:
on rightclick with tnt:
name of player's tool is "&eTNT &7(Click derecho)":
clicked block is not air:
if "%region at player%" contains "lobby":
stop
else:
set {tntof::%player%} to player
send "%{tntof::%player%}%" to player
set {_block.loc} to block 1 up event-location
if block at {_block.loc} is air:
remove 1 tnt from player's inventory
spawn 1 primed TNT at location of {_block.loc}
set fuse time of last spawned primed tnt to 60
else:
send "&7Busca espacio en el suelo para utilizar explosivos"
else:
send "&7Mira al suelo para utilizar explosivos"
on damage:
#The problem is that using attacker here will not be 100%
#efficient because It will be refired to the last player who
#hitted victim and not the player who placed the tnt.
if {tntof::%attacker%} is set:
#do stuff
- No console errors.
- Skript 2.2 Bensku dev24, SkRayFall, QkQuery, Skellet (I'm using them for other skripts, not for this one).
Thanks
Last edited: