lazarus321
Member
- Joined
- May 8, 2017
- Messages
- 209
- Reaction score
- 20
Does anyone know why this error is happening when i buy an item from this npc?
the .xml file is this
and
the .xml file is this
HTML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Aldo" script="Aldo.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100" />
<look type="128" head="40" body="37" legs="116" feet="95" addons="0" />
<parameters>
<parameter key="message_greet" value="Just great, another ... 'customer'. Hello, |PLAYERNAME|. If you want to trade, let's get it over with." />
<parameter key="message_farewell" value="That's music in my ears." />
<parameter key="message_walkaway" value="Yeah, get lost." />
<parameter key="message_onsendtrade" value="Yeah, buy something." />
<parameter key="module_shop" value="1" />
<parameter key="shop_buyable" value=" Brass Helmet,2460,120; Brass Legs,2478,195; Chain Helmet,2458,52; Chain Legs,2648,80; Iron Helmet,2459,390; Leather Boots,2643,10; Leather Helmet,2461,12; Leather Legs,2649,10; Sandals,2642,2; Soldier Helmet,2481,110; Steel Helmet,2457,580; Studded Helmet,2482,63; Studded Legs,2468,50; Viking Helmet,2473,265 " />
<parameter key="shop_sellable" value=" Brass Helmet,2460,30; Brass Legs,2478,49; Chain Helmet,2458,17; Chain Legs,2648,25; Iron Helmet,2459,150; Leather Boots,2643,2; Leather Helmet,2461,4; Leather Legs,2649,9; Legion Helmet,2480,22; Plate Legs,2647,115; Small Axe,2559,5; Soldier Helmet,2481,16; Steel Helmet,2457,293; Studded Helmet,2482,20; Studded Legs,2468,15; Viking Helmet,2473,66 " />
</parameters>
</npc>
and
HTML:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if isInArray({"soft boots", "repair", "soft", "boots"}, msg) then
npcHandler:say("Do you want to repair your worn soft boots for 10000 gold coins?", cid)
npcHandler.topic[cid] = 1
elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
npcHandler.topic[cid] = 0
if player:getItemCount(10021) == 0 then
npcHandler:say("Sorry, you don't have the item.", cid)
return true
end
if not player:removeMoney(10000) then
npcHandler:say("Sorry, you don't have enough gold.", cid)
return true
end
player:removeItem(10021, 1)
player:addItem(6132, 1)
npcHandler:say("Here you are.", cid)
elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
npcHandler.topic[cid] = 0
npcHandler:say("Ok then.", cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())