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

Check Items Hand

masterash

Member
Joined
Jan 2, 2013
Messages
35
Reaction score
10
I need to check if certain items are being used in the hand slot.

I found this code, it works for 1 item id, but I needed to check 4 item id at the same time.

Lua:
local wand_id = 1111
    
    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid

    if wand_left ~= wand_id and wand_right ~= wand_id then
        return true
    end

What should I do to declare more than 1 item id in the variable "wand_id"?

Thanks guys!
 
Solution
I need to check if certain items are being used in the hand slot.

I found this code, it works for 1 item id, but I needed to check 4 item id at the same time.

Lua:
local wand_id = 1111
   
    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid

    if wand_left ~= wand_id and wand_right ~= wand_id then
        return true
    end

What should I do to declare more than 1 item id in the variable "wand_id"?

Thanks guys!
Lua:
local wands = {1111, 2222, 3333, 4444}
    
local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid

if not isInArray(wands, wand_left) and...
I need to check if certain items are being used in the hand slot.

I found this code, it works for 1 item id, but I needed to check 4 item id at the same time.

Lua:
local wand_id = 1111
   
    local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
    local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid

    if wand_left ~= wand_id and wand_right ~= wand_id then
        return true
    end

What should I do to declare more than 1 item id in the variable "wand_id"?

Thanks guys!
Lua:
local wands = {1111, 2222, 3333, 4444}
    
local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid

if not isInArray(wands, wand_left) and not isInArray(wands, wand_right) then
    return true
end
 
Solution
Lua:
local wands = {1111, 2222, 3333, 4444}
   
local wand_left = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
local wand_right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid

if not isInArray(wands, wand_left) and not isInArray(wands, wand_right) then
    return true
end
Thanks man!

Worked perfectly!
 
Back
Top