Postado Outubro 25, 2014 10 anos Pronto cara, sem perder a calma kkkkkk, só quis ajudar. Enfim, eu Editei o post, e não eu não copiei ou aproveitei nada do seu script '-'
Postado Outubro 25, 2014 10 anos @eviltox Relaxa, eu estou calmo. Só quero dizer que não vejo mudança alguma no resultado do script que você postou, por ter as funções praticamente idênticas as do meu, que não deu certo no servidor dele. The corrupt fear us. The honest support us. The heroic join us.
Postado Outubro 25, 2014 10 anos Autor 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). [Error - LuaInterface::loadFile] data/npc/scripts/addons.lua:50: ')' expected near 'then' deu esse erro amigo I like
Postado Outubro 25, 2014 10 anos [Error - LuaInterface::loadFile] data/npc/scripts/addons.lua:50: ')' expected near 'then' Uma desatenção minha, desculpe: 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()) The corrupt fear us. The honest support us. The heroic join us.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.