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

Lua Help in script

Ascuas Funkeln

Rakkedo Game
Joined
Apr 14, 2013
Messages
549
Solutions
32
Reaction score
305
Location
Poland
GitHub
AscuasFunkeln
Hello,
Someone can help me in this script? Im pretty retarded in tables xD
Lua:
local ITEMS = {26888, 26889, 26890}

function onUse(player, item, fromPosition, itemEx, toPosition)
local it = ItemType(itemEx.itemid)
    for k in pairs(ITEMS) do
        if it == (isInArray(k)) then
            doRemoveItem(item.uid, 1)
            doRemoveItem(itemEx.uid, 1)
            player:addItem(k+1, 1)
            end
                end
                    return true
end

What i need is:
a = Trigger item, used on item
b = old item
c = new item which has item id (b+1)

Item "a" can be used only on items from "ITEMS" list, then script should remove "a" and "b" item, then create "c" item.
:D
Thanks!
 
Solution
Hello,
Someone can help me in this script? Im pretty retarded in tables xD
Lua:
local ITEMS = {26888, 26889, 26890}

function onUse(player, item, fromPosition, itemEx, toPosition)
local it = ItemType(itemEx.itemid)
    for k in pairs(ITEMS) do
        if it == (isInArray(k)) then
            doRemoveItem(item.uid, 1)
            doRemoveItem(itemEx.uid, 1)
            player:addItem(k+1, 1)
            end
                end
                    return true
end

What i need is:
a = Trigger item, used on item
b = old item
c = new item which has item id (b+1)

Item "a" can be used only on items from "ITEMS" list, then script should remove "a" and "b" item, then create "c" item.
:D
Thanks!

what TFS do you use?

-- edit...
Hello,
Someone can help me in this script? Im pretty retarded in tables xD
Lua:
local ITEMS = {26888, 26889, 26890}

function onUse(player, item, fromPosition, itemEx, toPosition)
local it = ItemType(itemEx.itemid)
    for k in pairs(ITEMS) do
        if it == (isInArray(k)) then
            doRemoveItem(item.uid, 1)
            doRemoveItem(itemEx.uid, 1)
            player:addItem(k+1, 1)
            end
                end
                    return true
end

What i need is:
a = Trigger item, used on item
b = old item
c = new item which has item id (b+1)

Item "a" can be used only on items from "ITEMS" list, then script should remove "a" and "b" item, then create "c" item.
:D
Thanks!

what TFS do you use?

-- edit

ah whatever. lol

try this
Lua:
local ITEMS = {26888, 26889, 26890}

function onUse(player, item, fromPosition, itemEx, toPosition)
    if isInArray(ITEMS, itemEx.itemid) then
        item:remove(1)
        itemEx:remove(1)
        player:addItem(itemEx.itemid + 1, 1)
    end
    return true
end
 
Last edited:
Solution
what TFS do you use?

-- edit

ah whatever. lol

try this
Lua:
local ITEMS = {26888, 26889, 26890}

function onUse(player, item, fromPosition, itemEx, toPosition)
    if isInArray(ITEMS, itemEx.itemid) then
        item:remove(1)
        itemEx:remove(1)
        player:addItem(itemEx.itemid + 1, 1)
    end
    return true
end
Sorry for lack of info, and ofc work perfect! Thanks
 
Back
Top