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 KeySell(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
[COLOR="#008080"] local price = [COLOR="#008080"][COLOR="#FF8C00"]1000 [/COLOR][/COLOR]-- enter the desired price here
local kid = [COLOR="#FF8C00"]6666 [/COLOR]-- action ID to set to key
local keyd = [COLOR="#FF8C00"]10000 [/COLOR]-- ID of the key
local descrp = "[COLOR="#FF8C00"]enter some text here[/COLOR]" -- Set a description for the key
local keynm = "[COLOR="#FF8C00"]Mystical Key[/COLOR]" -- Set a name for the key[/COLOR]
if getPlayerMoney(cid) >= price then
doPlayerRemoveMoney(cid, price)
local thing = doPlayerAddItem(cid, keyd)
doItemSetAttribute(thing, "aid", kid) -- Set action
doItemSetAttribute(thing, "description", descrp)
doItemSetAttribute(thing, "name", keynm) -- Set a name for the key
doSendMagicEffect(getCreaturePosition(cid), 12)
npcHandler:say('Well that was quite a bargain!',cid)
elseif
npcHandler:say('You don\'t have enough money.',cid)
end
end
keywordHandler:addKeyword({'key'}, KeySell, {})
npcHandler:addModule(FocusModule:new())