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 completed = 9000
local addon1 = 9001
local addon2 = 9002
if msg == "outfit" and getPlayerStorageValue(cid, completed) ~= 1 then
npcHandler:say("Do you want {outfit A} or {outfit B}?", cid)
talkState[cid] = 1
elseif msgcontains(msg, "outfit A") and talkState[cid] == 1 then
npcHandler:say("For Outfit A you need these items: Item1, Item2, Item3, Item4, Item5, Item6, and Item7. Do you have all the items?", cid) -- Replace with your Items Names
talkState[cid] = 2
elseif msgcontains(msg, "outfit B") and talkState[cid] == 1 then
npcHandler:say("For Outfit B you need these items: Item1, Item2, Item3, Item4, Item5, Item6, and Item7. Do you have all the items?", cid) -- Replace with your Items Names
talkState[cid] = 3
elseif msgcontains(msg, "yes") and talkState[cid] == 2 then
-- Replace the item ids with yours
if getPlayerItemCount(cid, 2382) >= 1 and getPlayerItemCount(cid, 2398) >= 1 and getPlayerItemCount(cid, 2050) >= 1 and getPlayerItemCount(cid, 5710) >= 1 and getPlayerItemCount(cid, 2120) >= 1 and getPlayerItemCount(cid, 2550) >= 1 and getPlayerItemCount(cid, 2554) >= 1 then
doPlayerRemoveItem(cid, 2382, 1)
doPlayerRemoveItem(cid, 2398, 1)
doPlayerRemoveItem(cid, 2050, 1)
doPlayerRemoveItem(cid, 5710, 1)
doPlayerRemoveItem(cid, 2120, 1)
doPlayerRemoveItem(cid, 2550, 1)
doPlayerRemoveItem(cid, 2554, 1)
npcHandler:say("Enjoy your new outfit!", cid)
doPlayerAddOutfit(cid, 128, 3) -- This is just the id for the citizen outfit and the 3 means FULL Addons, 0 = no addons, 1= addon 1, 2 = addon 2.
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
setPlayerStorageValue(cid, completed, 1)
setPlayerStorageValue(cid, addon1, 1)
talkState[cid] = 0
else
npcHandler:say("You do not have all the items!", cid)
end
elseif msgcontains(msg, "yes") and talkState[cid] == 3 then
-- Replace the item ids with yours
if getPlayerItemCount(cid, 2382) >= 1 and getPlayerItemCount(cid, 2398) >= 1 and getPlayerItemCount(cid, 2050) >= 1 and getPlayerItemCount(cid, 5710) >= 1 and getPlayerItemCount(cid, 2120) >= 1 and getPlayerItemCount(cid, 2550) >= 1 and getPlayerItemCount(cid, 2554) >= 1 then
doPlayerRemoveItem(cid, 2382, 1)
doPlayerRemoveItem(cid, 2398, 1)
doPlayerRemoveItem(cid, 2050, 1)
doPlayerRemoveItem(cid, 5710, 1)
doPlayerRemoveItem(cid, 2120, 1)
doPlayerRemoveItem(cid, 2550, 1)
doPlayerRemoveItem(cid, 2554, 1)
setPlayerStorageValue(cid, completed, 1)
setPlayerStorageValue(cid, addon2, 1)
doPlayerAddOutfit(cid, 128, 3)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYDAMAGE)
npcHandler:say("Enjoy your new outfit!", cid)
talkState[cid] = 0
else
npcHandler:say("You do not have all the items!", cid)
end
elseif msgcontains(msg, "no") and (talkState[cid] == 2 or talkState[cid] == 3) then
npcHandler:say("Ok then.", cid)
talkState[cid] = 0
elseif getPlayerStorageValue(cid, completed) == 1 then
if getPlayerStorageValue(cid, addon1) == 1 then
npcHandler:say("You have already received {Outfit A}.", cid)
elseif getPlayerStorageValue(cid, addon2) == 1 then
npcHandler:say("You have already received {Outfit B}.", cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())