Ir para conteúdo

Lucas Lorenzeti

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    Lucas Lorenzeti deu reputação a Wise em arrumar esse script de addon   
    Amigo, você postou um script quase exatamente igual ao meu, além de que nem fez questão de modificar os valores do custo de cada parâmetro do NPC. Como acha que vai mudar o resultado?


     
    Está tudo certo. Fiz outro:
    local tab = { prices = {500000, 1000000} -- {first, second} } 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 npcHandler:setMessage(MESSAGE_GREET, 'Hi |PLAYERNAME|. I sell the {first addons} set for '..tab.prices[1]..' gold coins and the {second addons} set for '..tab.prices[2]..' gold coins.') if (msgcontains(msg, 'first addons')) then talkState[talkUser] = 1 selfSay('Are you sure?', cid) elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if (doPlayerRemoveMoney(cid, tab.prices[1]) == true) then talkState[talkUser] = 0 doPlayerAddAddons(cid, 1) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) selfSay('Here you are.', cid) else talkState[talkUser] = 0 selfSay('Sorry, you do not have enough money.', cid) end elseif (msgcontains(msg, 'second addons')) then talkState[talkUser] = 2 selfSay('Are you sure?', cid) elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 2) then if (doPlayerRemoveMoney(cid, tab.prices[2]) == true) then talkState[talkUser] = 0 doPlayerAddAddons(cid, 2) doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS) selfSay('Here you are.', cid) else talkState[talkUser] = 0 selfSay('Sorry, you do not have enough money.', cid) end elseif (msgcontains(msg, 'no')) then talkState[talkUser] = 0 selfSay('Okay, goodbye!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Se ainda não der certo enquanto ao player receber os addons, verifique se você tem a função doPlayerAddAddons em sua 050-function.lua. É uma possibilidade pra esse problema, e não se esqueça de reportar erros no distro (caso tenha).

Informação Importante

Confirmação de Termo