Quote Originally Posted by Irax View Post
Code:
--[[ YOU CAN USE THIS AS A STANDALONE SCRIPT OR ADD IT TO A LABEL MANAGER SCRIPT AND 
      TOGGLE IT ON AND OFF BY CHANGING THIS VARIABLE IN YOUR LABELS. ]]--
local safeStrike = true

registerEventListener(TIMER_TICK, "onTick")
function onTick()
    if safeStrike then
        local pos = Self.LookPos()
        for i = CREATURES_LOW, CREATURES_HIGH do
            local c = Creature.GetFromIndex(i)
            if c:isAlive() and c:isPlayer() and (c:Position().x == pos.x and c:Position().y == pos.y and c:Position().z == pos.z) then
                Self.Turn(math.abs(Self.LookDirection() - 1))
            end
        end
    end
end
Script No Work
It works well with the module system, too.

Code:
function SafeStrike(module)
    if safeStrike then
        local pos = Self.LookPos()
        for i = CREATURES_LOW, CREATURES_HIGH do
            local c = Creature.GetFromIndex(i)
            if c:isAlive() and c:isPlayer() and (c:Position().x == pos.x and c:Position().y == pos.y and c:Position().z == pos.z) then
                Self.Turn(math.abs(Self.LookDirection() - 1))
            end
        end
    end
end
Module.New('safestrike', SafeStrike)