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

Lua Premium shop wont sell certain items.

MadMOOK

Hoo
Joined
Apr 20, 2011
Messages
802
Reaction score
43
Ive copied items in items.otb and added them to items.xml.. They work in game and they drop by monsters, everything is good. They show up in my premium shop, but players can not buy them, it doesnt even do the "you do not have enough points" message for them like it will for other items... any cause for this?
hmmmwhyyyy_zpsf81b2d9f.png

The darklord's cape and boots of haste are the only buyable items here, they still have their original item id's.

Is there somewhere i need to add new item ids to get them to work with npc system??
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local shopWindow = {}
local t = {
[2195] = 5,
[8865] = 500,
[12706] = 2000,
[12704] = 1000,
[12701] = 2000,
[12699] = 100
}
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
if t[item] and getAccountPoints(cid) < t[item] then
selfSay("You need "..t[item].." points to buy this item.", cid)
else
doAccountRemovePoints(cid, t[item])
doPlayerAddItem(cid, item)
selfSay("Here your item!", cid)
end
return true
end
if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
for var, ret in pairs(t) do
table.insert(shopWindow, {id = var, subType = 0, buy = ret, sell = 0, name = getItemNameById(var)})
end
openShopWindow(cid, shopWindow, onBuy, onSell)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
What AAC do you use? I may be wrong but, as far as I can remember, -- some -- shop systems like these actually use an item.otb parser, but I may be wrong and hallucinating.

EDIT: Oh wait how dumb of me, that looks like a LUA system xD. Let me read through it.
 
I use Znotes AAC. But that script your looking at is a NPC, in game and it works for any item accept ones i make myself for some reason.
Znotes shop on my website does work with my new items
 
I am 90% sure the problem is in this
Code:
if t[item] and getAccountPoints(cid) < t[item] then

but I cannot really identify what could go wrong with this line... I'll think about it and reply if no one else replies before me.

EDIT: I'm sure you know about having to add values for your new itemid and it's cost, Right?

Adding a new item in that system is basically:
Code:
local t = { [2195] = 5, [8865] = 500, [12706] = 2000, [12704] = 1000, [12701] = 2000, [12699] = 100 }
Adding
Code:
, [itemidhere] = costhere
to the last number in that table.
 
Back
Top