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

TFS 1.X+ Action Key tfs 1.5

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
879
Solutions
7
Reaction score
122
Location
Brazil
YouTube
caruniawikibr
could someone tell me how I set action on one of the items? ?because here for example there is a key

Lua:
local bagItemId = 1987

local items =

{

{1948, 1},

{2151,2},

{2165,1},

{2091,1}:setActionId(6010)

}
 

Attachments

Solution
@bpm91 try it:

Lua:
local items = {{1948, 1}, {2151, 2}, {2165, 1}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(8077) ~= -1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It's empty.")
        return true
    end

    local bagItemId = player:addItem(1987)
    for i = 1, #items do
        bagItemId:addItem(items[i][1], items[i][2])
    end
    local key = bagItemId:addItem(2091, 1)
    if bagItemId then
        key:setActionId(6010)
    end
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a parchment, 2 talons, stealth ring and golden key!")
    player:setStorageValue(8077, 1)
    return true
end
could someone tell me how I set action on one of the items? ?because here for example there is a key

Lua:
local bagItemId = 1987

local items =

{

{1948, 1},

{2151,2},

{2165,1},

{2091,1}:setActionId(6010)

}
Show the full code.

I know exactly which code you are using, but for people to help you effectively (and for future people with the same/similar problem), you need to provide all of the necessary information in this thread.
 
local bagItemId = 1987
local items =
{
{1948, 1},
{2151,2},
{2165,1},
setActionId(6010):{2091,1}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(8077) ~= -1 then
player:sendTextMessage(MESSAGE_INFO_DESCR,"It's empty.")
return true
end

if not player:giveItems(items, bagItemId, false) then
return true
end

player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a parchment, 2 talons, stealth ring and golden key!")
player:setStorageValue(8077, 1)
return true
end
 
@bpm91 try it:

Lua:
local items = {{1948, 1}, {2151, 2}, {2165, 1}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(8077) ~= -1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It's empty.")
        return true
    end

    local bagItemId = player:addItem(1987)
    for i = 1, #items do
        bagItemId:addItem(items[i][1], items[i][2])
    end
    local key = bagItemId:addItem(2091, 1)
    if bagItemId then
        key:setActionId(6010)
    end
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a parchment, 2 talons, stealth ring and golden key!")
    player:setStorageValue(8077, 1)
    return true
end
 
Last edited by a moderator:
Solution
@bpm91 try it:

Lua:
local items = {{1948, 1}, {2151, 2}, {2165, 1}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(8077) ~= -1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It's empty.")
        return true
    end

    local bagItemId = player:addItem(1987)
    for i = 1, #items do
        bagItemId:addItem(items[i][1], items[i][2])
    end
    local key = bagItemId:addItem(2091, 1)
    if bagItemId then
        key:setActionId(6010)
    end
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a parchment, 2 talons, stealth ring and golden key!")
    player:setStorageValue(8077, 1)
    return true
end
Congratulations on your answer!
 
Last edited by a moderator:
unfortunately I was absent from the community for a while, because I had personal problems, I don't even remember where I stopped, answering the knight, I'm not a scripter, I'm an administrator, that is, either I pay to do the services or I can very well ask for help.
I will now check this action and I will test it.
however knight, I don't do lazy and poorly done jobs to take money from others by making me a "professional" spriter ctrl c ctrl v
Post automatically merged:

@bpm91 try it:

Lua:
local items = {{1948, 1}, {2151, 2}, {2165, 1}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(8077) ~= -1 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It's empty.")
        return true
    end

    local bagItemId = player:addItem(1987)
    for i = 1, #items do
        bagItemId:addItem(items[i][1], items[i][2])
    end
    local key = bagItemId:addItem(2091, 1)
    if bagItemId then
        key:setActionId(6010)
    end
    player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a parchment, 2 talons, stealth ring and golden key!")
    player:setStorageValue(8077, 1)
    return true
end



A tfu spamer, OTS community die every year, And you writing stupid spam messages.. instead help to ppl who try do something, makeing new ots.. A TFU
Ty vexler work 100%, ty xikini for answer
 
Last edited:
Back
Top