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

a bag with items

krille09

Belden
Joined
Aug 15, 2007
Messages
4,894
Reaction score
55
Location
Stockholm, Sweden
hi,

anyone can tell me how to when i take a quest i get a bag with 2 items in it instead of doing 2 chests for 2 items


so long:
PHP:
function onUse(cid, item, frompos, item2, topos)
	if getPlayerLevel(cid) >= 40 then
   	if item.uid == 7711 then
   		queststatus = getPlayerStorageValue(cid,7811)
   		if queststatus == -1 then
		doPlayerSendTextMessage(cid,22,"You have found a bag.")
   		doPlayerAddItem(cid,1987,1)
   		setPlayerStorageValue(cid,7811,1)
 
kk thanks

is this good?
PHP:
function onUse(cid, item, frompos, item2, topos)
   	if item.uid == 7711 then
		if getPlayerLevel(cid) >= 40 then
			doPlayerSendCancel(cid,"You don't have enough level required.")
		end
   		queststatus = getPlayerStorageValue(cid,7811)
   		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a bag.")
			doPlayerAddItem(cid,1987,1)
			doAddContainerItem(cid,7730,1)
			doAddContainerItem(cid,2152,50)
			setPlayerStorageValue(cid,7811,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	else
		return 0
	end
	
	return 1
end
 
No.

You have to declare the container like this:

Code:
local container = doPlayerAddItem(cid, 2000, 1)
doAddContainerItem(container, itemid, count)

For BP of something you can use:
Code:
for i = 1, 20 -- full backpack
    doAddContainerItem(container, itemid, count/type)
end
 
kk thanks

is this good?
PHP:
function onUse(cid, item, frompos, item2, topos)
   	if item.uid == 7711 then
		if getPlayerLevel(cid) >= 40 then
			doPlayerSendCancel(cid,"You don't have enough level required.")
		end
   		queststatus = getPlayerStorageValue(cid,7811)
   		if queststatus == -1 then
			doPlayerSendTextMessage(cid,22,"You have found a bag.")
			doPlayerAddItem(cid,1987,1)
			doAddContainerItem(cid,7730,1)
			doAddContainerItem(cid,2152,50)
			setPlayerStorageValue(cid,7811,1)
		else
			doPlayerSendTextMessage(cid,22,"It is empty.")
		end
	else
		return 0
	end
	
	return 1
end

That one will not work ? or im wrong ?
 
Code:
function onUse(cid, item, frompos, item2, topos)
	local queststatus = getPlayerStorageValue(cid,7811)
	if item.uid == 7711 then
		if getPlayerLevel(cid) < 40 then
			doPlayerSendCancel(cid,"You don't have enough level required.")
			return TRUE
		end
		if queststatus == - 1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a bag.")
			local container = doPlayerAddItem(cid,1987,1)
			doAddContainerItem(container, 7730, 1)
			doAddContainerItem(container, 2152, 50)
			setPlayerStorageValue(cid, 7811, TRUE)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
		end
	end
	return TRUE
end
 
Back
Top