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

talkaction !buytools Proplem with script

Na Amigo

The crazy girl
Joined
Jun 5, 2017
Messages
254
Solutions
3
Reaction score
18
Location
Egypt
when iam using this script in my server got this error here's the errror
Code:
[18:58:55.949] [Error - TalkAction Interface]
[18:58:55.949] data/talkactions/scripts/buytools.lua:onSay
[18:58:55.949] Description:
[18:58:55.965] (luaDoAddContainerItem) Container not found
Code:
    <talkaction words="!buytools" script="buytools.lua"/>
and buytools.lua :-
Code:
function onSay(cid, words, param)
local cfg = {
    time = 3601,
    exhausted = 3600,
    storage = 90327,
}
    if getPlayerStorageValue(cid, cfg.storage) > os.time() then
      doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You can only use this function once every 30 minutes.")
else
     doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Frodo: Here are your tools!")
    container = doPlayerAddItem(cid, 2456, 1)
    doAddContainerItem(container, 2268, 1)
   
    doAddContainerItem(container, 2273, 1)

    doAddContainerItem(container, 2361, 1)
    doAddContainerItem(container, 2091, 1)
        doAddContainerItem(container, 7731, 1)
    setPlayerStorageValue(cid, cfg.storage, os.time() + cfg.exhausted)
    end
end
 
Solution
Should work.
Basically a culmination of everyone above's comments, and some slight restructuring.
Added a few 'quality of life' improvements as well. (animations, tabbing, spacing.)
Lua:
local cfg = {
   time = 3601,
   exhausted = 3600,
   storage = 90327
}

function onSay(cid, words, param)
   if getPlayerStorageValue(cid, cfg.storage) > os.time() then
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You can only use this function once every 30 minutes.")
       doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
       return true
   end
 
   local container = doPlayerAddItem(cid, 1988, 1, true)
   doAddContainerItem(container, 2268, 1)
   doAddContainerItem(container, 2273, 1)
   doAddContainerItem(container, 2361, 1)...
Are you sure item id "2456" is container?
i have created new script and it's not working too :(
Code:
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid,10000) == TRUE then
doPlayerAddItem(cid,1988,1)
doAddContainerItem(1988, 2456, 1)
doAddContainerItem(1988, 2268, 1)
doAddContainerItem(1988, 2273, 1)
doAddContainerItem(1988, 2361, 1)
doAddContainerItem(1988, 2091, 1)
doAddContainerItem(1988, 7731, 1)
doAddContainerItem(1988, 5710, 1)
doPlayerSendTextMessage(cid,1,"Here are your tools!")
else
doPlayerSendTextMessage(cid,1,"Frodo: Sorry, you do not have enough money.")
    end
    return 1

end
the same error
 
when iam using this script in my server got this error here's the errror
Code:
[18:58:55.949] [Error - TalkAction Interface]
[18:58:55.949] data/talkactions/scripts/buytools.lua:onSay
[18:58:55.949] Description:
[18:58:55.965] (luaDoAddContainerItem) Container not found
Code:
    <talkaction words="!buytools" script="buytools.lua"/>
and buytools.lua :-
Code:
function onSay(cid, words, param)
local cfg = {
    time = 3601,
    exhausted = 3600,
    storage = 90327,
}
    if getPlayerStorageValue(cid, cfg.storage) > os.time() then
      doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You can only use this function once every 30 minutes.")
else
     doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Frodo: Here are your tools!")
    container = doPlayerAddItem(cid, 2456, 1)
    doAddContainerItem(container, 2268, 1)
  
    doAddContainerItem(container, 2273, 1)

    doAddContainerItem(container, 2361, 1)
    doAddContainerItem(container, 2091, 1)
        doAddContainerItem(container, 7731, 1)
    setPlayerStorageValue(cid, cfg.storage, os.time() + cfg.exhausted)
    end
end
1st of all, 2456 - item id of bow, 2nd try to change:
Lua:
container = doPlayerAddItem(cid, 2456, 1)
to
Lua:
local container = doPlayerAddItem(cid, 1988, 1)
 
Should work.
Basically a culmination of everyone above's comments, and some slight restructuring.
Added a few 'quality of life' improvements as well. (animations, tabbing, spacing.)
Lua:
local cfg = {
   time = 3601,
   exhausted = 3600,
   storage = 90327
}

function onSay(cid, words, param)
   if getPlayerStorageValue(cid, cfg.storage) > os.time() then
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You can only use this function once every 30 minutes.")
       doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
       return true
   end
 
   local container = doPlayerAddItem(cid, 1988, 1, true)
   doAddContainerItem(container, 2268, 1)
   doAddContainerItem(container, 2273, 1)
   doAddContainerItem(container, 2361, 1)
   doAddContainerItem(container, 2091, 1)
   doAddContainerItem(container, 7731, 1)
 
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Frodo: Here are your tools!")
   setPlayerStorageValue(cid, cfg.storage, os.time() + cfg.exhausted)
   return true
end
 
Solution
Back
Top