• 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!

help putting check in this script?

demonrage

New Member
Joined
Oct 28, 2014
Messages
22
Reaction score
2
Can someone help me here, to put some check on not moving the item from the equipped slot, while the summoned pet is on the map.

otx2

Script:

Lua:
local itemsBlocked = {12345}

local function isItemEquippedInSlots(cid, uid)
    for slot = 1, 10 do
        if slot ~= 3 and getPlayerSlotItem(cid, slot).uid == uid then
            return true
        end
    end
    return false
end

function onThrow(cid, item, fromPosition, toPosition)
    local fromPlayer = fromPosition.x == 65535
    local toPlayer = toPosition.x == 65535

    if fromPlayer and not toPlayer and isInArray(itemsBlocked, item.itemid) then
        if isItemEquippedInSlots(cid, item.uid) then
            doPlayerSendCancel(cid, "Você não pode mover este item enquanto estiver equipado!")
            return false
        end
    end

    return true
end
 
how can I do this?
This is an example:

Code:
<event type="moveitem" name="MoveItem" event="script" value="moveitem.lua"/>

Lua:
function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos)
    local restrictedItemID = 7845 -- Fire Sword
    local restrictedSlot = CONST_SLOT_LEFT
    local restrictedStorage = 5000

    if item.itemid == restrictedItemID and fromContainer == restrictedSlot and getPlayerStorageValue(cid, restrictedStorage) == 1 then
        return doPlayerSendCancel(cid, 'You cannot move that weapon.') and false
    end
   
    return true
end
 
This is an example:

Code:
<event type="moveitem" name="MoveItem" event="script" value="moveitem.lua"/>

Lua:
function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos)
    local restrictedItemID = 7845 -- Fire Sword
    local restrictedSlot = CONST_SLOT_LEFT
    local restrictedStorage = 5000

    if item.itemid == restrictedItemID and fromContainer == restrictedSlot and getPlayerStorageValue(cid, restrictedStorage) == 1 then
        return doPlayerSendCancel(cid, 'You cannot move that weapon.') and false
    end
  
    return true
end
it didn't work
 
Back
Top