• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

I want the spell not to be used in combat

Michcol94

Member
Joined
Sep 2, 2021
Messages
105
Reaction score
18
Lua:
function onSay(player, words, param)
    -- Warunek dostępności dla wszystkich graczy
    --if not player:getGroup():getAccess() then
    --    return true
    --end

    -- Warunek niedostępności czaru w trakcie walki
    if player:getCondition(CONDITION_INFIGHT) then
        player:sendCancelMessage("Nie możesz użyć tego czaru podczas walki.")
        return false
    end

    local target = Creature(param)
    if target then
        -- Warunek wymagający minimum 50% many u celu
        if target:getMana() >= target:getMaxMana() * 0.5 then
            player:teleportTo(target:getPosition())
        else
            player:sendCancelMessage("Gracz do którego chcesz się teleportować ma mniej niż 50% many.")
        end
    else
        player:sendCancelMessage("Nie odnaleziono stworzenia.")
    end
    return false
end
 
There is an existing check for that already
Lua:
    if player:getCondition(CONDITION_INFIGHT) then
        player:sendCancelMessage("Nie możesz użyć tego czaru podczas walki.")
        return false
    end

If by combat you meant "PZ Locked" then just replace this line
Lua:
if player:getCondition(CONDITION_INFIGHT) then

With
Lua:
if player:isPzLocked() then
 
If we have Fighting and we can not log out, we can not use spell
Lua:
if player:getCondition(CONDITION_INFIGHT) or player:isPzLocked() then

u gonna need at least a basic understanding of logic/programming if you intend to keep a server online.
 
Try changing
Code:
if player:getCondition(CONDITION_INFIGHT) then
to
Try changing
Code:
if player:getCondition(CONDITION_INFIGHT) ~= nil then
 
Back
Top