• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Help with more advanced quest chest please

rudger

Active Member
Joined
Oct 1, 2010
Messages
273
Solutions
1
Reaction score
45
Location
The Netherlands
I'd like this to be added to my quest chest:

if backpack space < 1 then
doPlayerSendTextMessage(cid,22, "Sorry, you do not have enough space in your backpack.")

Notice: I don't have the function getItemWeightById and I'm using Avesta 7.6

My script:

LUA:
function onUse(cid, item, frompos, item2, topos)
queststatus = getPlayerStorageValue(cid,16222)
if item.uid == 16222 then
if queststatus == 0 or queststatus == -1 and getPlayerFreeCap(cid) < 100 then
doPlayerSendTextMessage(cid,22,"You have found a chain armor. Weighing 100 oz. It is too heavy.")
elseif queststatus == 0 or queststatus == -1 and getPlayerFreeCap(cid) >= 100 then
doPlayerSendTextMessage(cid,22,"You have found a chain armor.")
doPlayerAddItem(cid,2464,1)
setPlayerStorageValue(cid,16222,1)
else
doPlayerSendTextMessage(cid,22,"The chest is empty.")
end
else
return 0
end
return 1
end

I think I have to use something like: doCreateItemEx and doPlayerAddItemEx .

But I'm just getting the error: luaDoPlayerAddItemEx<>. Item not found all the time.
 
Last edited:
I don't know if this will work but maybe you can try this:

change:

LUA:
elseif(doPlayerAddItemEx(cid, 2464, true) ~= RETURNVALUE_NOERROR) then

with:
LUA:
elseif getPlayerSlotItem(cid,2).count == 0 then

and:
LUA:
doPlayerAddItemEx

with:
LUA:
doPlayerAddItem
 
Possible solution

Hello rudger,

try this
Code:
function onUse(cid, item, frompos, item2, topos)
queststatus = getPlayerStorageValue(cid,16222)
if item.uid == 16222 then
if queststatus == -1 and getPlayerFreeCap(cid) < 100 then
doPlayerSendTextMessage(cid,22,"You have found a chain armor. Weighing 100 oz. It is too heavy.")
else
doPlayerSendTextMessage(cid,22,"You have found a chain armor.")
doPlayerAddItem(cid,2464,1)
setPlayerStorageValue(cid,16222,1)
else
doPlayerSendTextMessage(cid,22,"The chest is empty.")
end
else
return 0
end
return 1
end

if i helped rep++

king regards
 
Back
Top