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

[Help] Npc exchanger

klekSu

Stroke my ego.
Joined
Nov 4, 2008
Messages
1,285
Reaction score
18
Hi i got a problem with some npc. He's not answering on other words than "100 soul orbs", why? Also, he's removing me all the orbs i got insted of 100. Somebody help please? here's the .lua:

Code:
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, '50 demonic essences') or msgcontains(msg, '50 demonic essence') then
selfSay('Do you want me to change demonic essences for mana rune?', cid)
talkState = 1
elseif msgcontains(msg, 'yes') then
if talkState == 1 then
if getPlayerItemCount(cid, 6500) >= 50 then
if doPlayerRemoveItem(cid, 6500, 50) == TRUE then
local item = getPlayerItemById(cid, TRUE, 6500)
doTransformItem(item.uid, 2270, 50)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
else
selfSay('Sorry, you don\'t have the item.', cid)
end
end
talkState = 0
elseif msgcontains(msg, 'no') and isInArray({1}, talkState) == TRUE then
talkState = 0
selfSay('Ok then.', cid)
end
return TRUE
end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, '100 demonic essences') or msgcontains(msg, '100 demonic essence') then
selfSay('Do you want me to change demonic essences for mana rune?', cid)
talkState = 1
elseif msgcontains(msg, 'yes') then
if talkState == 1 then
if getPlayerItemCount(cid, 6500) >= 100 then
if doPlayerRemoveItem(cid, 6500, 100) == TRUE then
local item = getPlayerItemById(cid, TRUE, 6500)
doTransformItem(item.uid, 2270, 100)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
else
selfSay('Sorry, you don\'t have the item.', cid)
end
end
talkState = 0
elseif msgcontains(msg, 'no') and isInArray({1}, talkState) == TRUE then
talkState = 0
selfSay('Ok then.', cid)
end
return TRUE
end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, '100 soul orbs') or msgcontains(msg, '100 soul orb') then
selfSay('Do you want me to change soul orbs for mighty healing rune?', cid)
talkState = 1
elseif msgcontains(msg, 'yes') then
if talkState == 1 then
if getPlayerItemCount(cid, 5944) >= 100 then
if doPlayerRemoveItem(cid, 5944, 100) == TRUE then
local item = getPlayerItemById(cid, TRUE, 5944)
doTransformItem(item.uid, 2298, 100)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
else
selfSay('Sorry, you don\'t have the item.', cid)
end
end
talkState = 0
elseif msgcontains(msg, 'no') and isInArray({1}, talkState) == TRUE then
talkState = 0
selfSay('Ok then.', cid)
end
return TRUE
end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, '100 soul orbs') or msgcontains(msg, '100 soul orb') then
selfSay('Do you want me to change demonic essences for mighty healing rune?', cid)
talkState = 1
elseif msgcontains(msg, 'yes') then
if talkState == 1 then
if getPlayerItemCount(cid, 5944) >= 100 then
if doPlayerRemoveItem(cid, 5944, 100) == TRUE then
local item = getPlayerItemById(cid, TRUE, 5944)
doTransformItem(item.uid, 2298, 100)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
else
selfSay('Sorry, you don\'t have the item.', cid)
end
end
talkState = 0
elseif msgcontains(msg, 'no') and isInArray({1}, talkState) == TRUE then
talkState = 0
selfSay('Ok then.', cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top