Substitui todo seu código por esse:
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 -- VARIÁVEIS -- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid msg = string.lower(msg) local id_coin = 2152 -- ID DO GOLD COIN local quantidade_coin = 40 -- QUANTIDADE COINS QUE PRECISA PARA VIAJAR local level = 30 --LEVEL MÍNIMO PARA VIAJAR local position = {x= 998, y= 992, z= 5} -- POSIÇÃO DE ONDE O PLAYER IRÁ AO SER TELEPORTADO ----------------------------------- [ DIALOGO COM NPC] --------------------------------- if msgcontains(msg, 'help') or msgcontains(msg, 'travel') or msgcontains(msg, 'viagem') then selfSay("I can take you to {Ice Island} for " ..quantidade_coin.. " gold coins. Do you want?", cid) talkState[talkUser] = 1 elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then if isPremium(cid) then if getPlayerLevel(cid) >= level then if getPlayerItemCount(cid, id_coin) >= 40 then doPlayerRemoveItem(cid, id_coin, quantidade_coin) selfSay("See you!", cid) doTeleportThing(cid, position) talkState[talkUser] = 0 return true else selfSay("You don't have " ..quantidade_coin.. " gold coins.", cid) talkState[talkUser] = 0 return true end else selfSay("You need to be at least level" ..level.. " or more to travel.", cid) talkState[talkUser] = 0 return true end else selfSay("You need to be premium account to travel.", cid) talkState[talkUser] = 0 return true end elseif (msgcontains(msg, 'no') or msgcontains(msg, 'não')) and talkState[talkUser] == 1 then selfSay("Ok, goodbye.") talkState[talkUser] = 0 return true elseif (msgcontains(msg, "yes") ~= "yes" or msgcontains(msg, "sim") ~= "sim" or msgcontains(msg, "não") ~= "não" or msgcontains(msg, "no") ~= "no") and talkState[talkUser] == 1 then selfSay("I didn't understand your answer. Do you want to travel or not?", cid) return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Agora vai no arquivo xml desse npc e a partir da tag
<parameters> <TAG /> </parameters> </npc>
substitua tudo até o final por esse:
<parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|, say {help}, {viagem} or {travel} to more informations."/> </parameters> </npc>
Fiz verificação se é premium, verificação por nível e se tem a quantidade de gold coins necessária para viajar.
Lembre de trocar o id do gold coin na variável id_coin, pois eu não tenho base de Tibia, então testei com Poketibia, e não sei se o id do dinheiro é o mesmo.
Eu testei e está funcionando. Mas testa e fale se der algum problema.




info
Grupo: Artesão
Registrado: 15/03/07
Posts: 106
Reputação: +1
Gênero: Masculino
Eu tenho esse NPC de teleporte no meu servidor mais queria melhorar um pouco ele.
Colocar parra quando o jogador for usar o Teleporte, retirar valor "X" de dinheiro, mais continuar com sistema de restringir por premium e level.
e quando ele fala essa frase "Posso levar você para Ice Island por 40 gold coins?" ele esta falando no chat normal, como faz para ele falar no chat de NPC em Azul. ?
Editado Abril 3 por adrianokk
Correção