Jvkisuckbr
New Member
I have custom sprites in my server, and i need a npc who talks only to man or woman. help plz.
I use this script:
I use this script:
Lua:
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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local config = {
itemNeeded = 33525,
count = 5,
addonName = "sparrow",
outfitId = 1145,
giveAddons = 2,
storage = 3848,
}
if (msgcontains(msg, config.addonName)) then
if getPlayerStorageValue(cid,3848) < 1 then else return selfSay('Sorry, you this have a addon of '..config.addonName..' Outfit.', cid) end
selfSay("To achieve the "..config.addonName..", the more you need to give me certain items do you accept this trade? ", cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, "yes")) and talkState[talkUser] == 1 then
if doPlayerRemoveItem(cid, 33525, 5) then
doPlayerAddOutfit(cid,config.outfitId, config.giveAddons)
setPlayerStorageValue(cid, 3848, 1)
selfSay("Thank you, you can look at your inventory of outfits.",cid)
else selfSay('Sorry, you need a '..config.count..' of '..getItemName(config.itemNeeded)..' for complet a my trade.', cid) end
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())