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

Amulet, encahnted weapon with charges NPC

Mauzim

Member
Joined
Jan 3, 2011
Messages
568
Reaction score
9
When i have brand new or from 2-999/99 charges weapon or amulet I can't sell it any1 know this problem?:) Please help rep++
 
The text that you have entered is too long (48693 characters). Please shorten it to 37500 characters long.
What u want i can check and pase it here
 
Code:
	-- Callback onSell() function. If you wish, you can change certain Npc to use your onSell().
	function ShopModule:callbackOnSell(cid, itemid, subType, amount, ignoreCap, inBackpacks)
		local shopItem = nil
		for _, item in ipairs(self.npcHandler.shopItems) do
			if(item.id == itemid and item.subType == subType) then
				shopItem = item
				break
			end
		end

		if(shopItem == nil) then
			print('[Warning - ' .. getCreatureName(getNpcId()) .. '] NpcSystem:', 'ShopModule.onSell - Item not found on shopItems list')
			return false
		end

		if(shopItem.sell == -1) then
			print('[Warning - ' .. getCreatureName(getNpcId()) .. '] NpcSystem:', 'ShopModule.onSell - Attempt to sell an item which is only buyable')
			return false
		end

		local parseInfo = {
			[TAG_PLAYERNAME] = getPlayerName(cid),
			[TAG_ITEMCOUNT] = amount,
			[TAG_TOTALCOST] = amount * shopItem.sell,
			[TAG_ITEMNAME] = shopItem.name
		}

		if(subType < 1 or getItemInfo(itemid).stackable) then
			subType = -1
		end

		if(doPlayerRemoveItem(cid, itemid, amount, subType)) then
			local msg = self.npcHandler:getMessage(MESSAGE_SOLD)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, self.npcHandler:parseMessage(msg, parseInfo))

			doPlayerAddMoney(cid, amount * shopItem.sell)
			if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
				self.npcHandler.talkStart[cid] = os.time()
			else
				self.npcHandler.talkStart = os.time()
			end

			return true
		end

		local msg = self.npcHandler:getMessage(MESSAGE_NEEDITEM)
		doPlayerSendCancel(cid, self.npcHandler:parseMessage(msg, parseInfo))
		if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
			self.npcHandler.talkStart[cid] = os.time()
		else
			self.npcHandler.talkStart = os.time()
		end

		return false
	end
 
Code:
	function ShopModule:addSellableItem(names, itemid, cost, realName)
		if(SHOPMODULE_MODE ~= SHOPMODULE_MODE_TALK) then
			[B][COLOR="red"]local v = getItemInfo(itemid)[/COLOR][/B]
			local item = {
				id = itemid,
				buy = -1,
				sell = cost,
				subType = [B][COLOR="red"]v.charges > 0 and 0 or[/COLOR][/B] 1,
				name = realName or [B][COLOR="red"]v.name[/COLOR][/B]
			}
 
Last edited:
Back
Top