• 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 Add item with Action ID

atyll

Member
Joined
Dec 30, 2008
Messages
380
Reaction score
16
Okay, I am making a chest, that will add a KEY for a player with specific action ID. Anybody knows how to do it?

My script:


Code:
function onUse(cid, item, frompos, item2, topos)

if item.uid == 8334 then
queststatus = getPlayerStorageValue(cid,8334)
if queststatus == -1 then
  doPlayerSendTextMessage(cid,22,"You \'ve recieved a key.")
  doPlayerAddItem(cid,2089,1)
  setPlayerStorageValue(cid,8334,1)
else
  doPlayerSendTextMessage(cid,22,"It is empty.")
end
end

return 1
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, 8334) < 1 then
        doItemSetAttribute(doPlayerAddItem(cid, 2089, 1), "aid", 12345)
        setPlayerStorageValue(cid, 8334, 1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. getItemNameById(2089) .. ".")
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "It is empty.")
    end
    return true
end
 
I get error: attempt to call global 'doItemSetAttribute' <a nil value

By the way, I am using Avesta 0.6.3 7.6 server
 
That's why you should provide with more information when creating threads, e.g server version.

So which version of TFS are you using?


- - - Edited - - -

Code:
doSetItemActionId(doPlayerAddItem(cid, 2089, 1), 12345)
 
@Ninja code you pasted now works on all TFS revs, because doplayeradditem always returns uid so information about server version wasn't important
 
Back
Top