[/B]local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() 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 configs = {
ItemId = 10316,
ItemCount = 1,
Storage = 16439
}
if(msgcontains(msg, 'outfit')) then
if (getPlayerStorageValue(cid, configs.Storage) > 0) then
selfSay('You already have this outfit.', cid)
talkState[talkUser] = 0
else
selfSay('Did you bring the helmet?', cid)
talkState[talkUser] = 1
end
else
if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerItemCount(cid, configs.ItemId) == configs.ItemCount) then
doPlayerRemoveItem(cid, configs.ItemId, configs.ItemCount)
setPlayerStorageValue(cid, configs.Storage, 1)
doPlayerAddOutfit(cid, 73)
doSendMagicEffect(getPlayerPosition(cid), 12)
selfSay('Congratz, you now have a brand new outfit.', cid)
talkState[talkUser] = 0
else
selfSay('You don\'t have all the items.', cid)
talkState[talkUser] = 0
end
end
return TRUE
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())[B]