I iterate through the array to see who has targeted the player who uses the spell but then I cannot remove the target because of this error;
But it should work ? Look my code;
TFS 1.0
attempt to call method 'removeTarget' (a nil value)
But it should work ? Look my code;
Lua:
function onCastSpell(cid, var)
local attackers = Game.getSpectators(Player(cid):getPosition(), false, false, 0, 10, 0, 10)
for i = 1, #attackers do
if attackers[i]:getTarget(Player(cid)) then
attackers[i]:removeTarget(Player(cid))
end
end
return true
end
TFS 1.0
Last edited: