Ir para conteúdo
  • 0

Npc esta vendendo outfit mesmo sem gold


Carlos Vampetta

Pergunta

O npc vende o outfit até se o player estiver sem dinheiro =/

se ele estiver com dinheiro desconta normal, mas sem ele vende e não tira nada, qual o erro?

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())
Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0


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) return true 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())

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...