chupaescadatri
Banned User
- Joined
- Jul 5, 2014
- Messages
- 338
- Reaction score
- 49
The NPC sells the outfit even if you have no money.
but if you have money it cashes.
which the error?
but if you have money it cashes.
which the error?
Code:
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 = 2160,
count = 100,
addonName = "Beggar",
outfitId = 14,
storage = 3848,
}
if (msgcontains(msg, config.addonName)) then
if doPlayerRemoveItem(cid, config.itemNeeded, config.count) then else selfSay('Sorry, you need a '..config.count..' of '..getItemNameById(config.itemNeeded)..' for complet a my trade.', cid) end
if getPlayerStorageValue(cid, config.storage) < 1 then else return selfSay('Sorry, you this have a addon of '..config.addonName..' Outfit.', cid) end
selfSay("Well I give you "..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
selfSay("only rich people can buy my outfit.",cid)
talkState[talkUser] = 0
doPlayerAddOutfit(cid,config.outfitId, config.giveAddons)
setPlayerStorageValue(cid, config.storage, 1)
end
return true
end
keywordHandler:addKeyword({'outfit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell {Beggar} Outfit for 1k.'})
keywordHandler:addKeyword({'mission'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell {Beggar} Outfit for 1k.'})
keywordHandler:addKeyword({'task'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell {Beggar} Outfit for 1k.'})
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())