This is the code that I wrote:
This is the error message I got:
I have no idea how to solve it since I don't understand the problem with it.
I'm trying to use "getItemWeight(uid)" with "getPlayerFreeCap(cid)" to make sure that people that doesn't have enough cap won't complete the quest, get a storage value and then never recieve the item.
If you need additional information just ask!
King regards, Z.
Code:
local ITEM = 2195
local COUNT = 1
local DROPONGROUND = false
local ITEMNAME = getItemName(ITEM)
local STORAGE = getItemIdByName(ITEMNAME)
local WEIGHT = getItemWeight(ITEM, COUNT)
function onUse(cid, item, frompos, item2, topos)
if getPlayerFreeCap(cid) >= WEIGHT then
if getPlayerStorageValue(cid, STORAGE) ~= 1 then
doPlayerAddItem(cid, ITEM, COUNT, DROPONGROUND)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found "..ITEMNAME.."!")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
setPlayerStorageValue(cid, STORAGE, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough capacity.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
end
This is the error message I got:
Lua Script Error: [Action Interface]
data/actions/scripts/custom/quests/bohquest.lua
LuaScriptInterface::luaGetItemWeight(). Item not found
I have no idea how to solve it since I don't understand the problem with it.
I'm trying to use "getItemWeight(uid)" with "getPlayerFreeCap(cid)" to make sure that people that doesn't have enough cap won't complete the quest, get a storage value and then never recieve the item.
If you need additional information just ask!
King regards, Z.