Postado Julho 26, 2018 6 anos BASE PDA! Eai galerinha estou tendo um problema com um npc. Bem eu queria um npc Teleport que teleporta o player por um certo valor, já peguei todo tipo de scripts em sites e sempre da esse mesmo erro poderiam me ajudar soluciona-lo? Erro: Spoiler SCRIPT: Spoiler 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 a = { levelcidade1 = 30, -- Level que necessita para ir na cidade 1 levelcidade2 = 60, -- Level que necessita para ir na cidade 2 itemcidade1 = 2160, -- Item que necessita para viajar para cidade 1 itemcidade2 = 2190, -- Item que necessita para viajar para cidade 2 goldcidade1 = 1, -- Gold que precisa para viajar para cidade 1 goldcidade2 = 2000, -- Gold que precisa para viajar para cidade 2 poscidade1 = {x = 1054, y = 1058, z = 7}, -- Posição da cidade 1 poscidade2 = {x = 168, y = 58, z = 7}, -- Posição da cidade 2 } if msgcontains(msg, 'carlin') then if getPlayerItemCount(cid, a.itemcidade1) >= 1 then if getPlayerLevel(cid) >= a.levelcidade1 then if getPlayerMoney(cid) >= a.goldcidade1 then doTeleportThing(cid, a.poscidade1) doPlayerRemoveMoney(cid, a.goldcidade1) selfSay('Você foi teleportado para carlin!', cid) else selfSay('Você precisa de '..a.goldcidade1..' gold coins para viajar para {carlin}.', cid) end else selfSay('Você precisa ser '..a.levelcidade1..' para viajar para {carlin}.', cid) end else selfSay('Você precisa de uma '..getItemNameById(a.itemcidade1)..' para ir até {carlin}!', cid) end end if msgcontains(msg, 'thais') then if getPlayerItemCount(cid, a.itemcidade2) >= 1 then if getPlayerLevel(cid) >= a.levelcidade2 then if getPlayerMoney(cid) >= a.goldcidade2 then doTeleportThing(cid, a.poscidade2) doPlayerRemoveMoney(cid, a.goldcidade2) selfSay('Você foi teleportado para thais!', cid) else selfSay('Você precisa de '..a.goldcidade2..' gold coins para viajar para {thais}.', cid) end else selfSay('Você precisa ser '..a.levelcidade2..' para viajar para {thais}.', cid) end else selfSay('Você precisa de uma '..getItemNameById(a.itemcidade2)..' para ir até {thais}!', cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Pode ser outro script não tem problema desde que funcione, obrigado.
Postado Julho 26, 2018 6 anos @admelite 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 moeda = 2160 -- ID do item que será a moeda -- ["name"] = {Quantidade da moeda, Onde será teleportado, Level, vip(true or false)} local t = { ["konoha"] = {1, {x = 1012, y = 905, z = 7}, 1, false}, } if (msgcontains(msg, 'viajar')) then local str = "" str = str .. "Eu posso lhe levar para esses lugares: " for name, pos, d, c in pairs(t) do str = str.." {"..name.."} por {"..pos[1].."} gold bars, " end str = str .. "." npcHandler:say(str, cid) elseif t[msg] then if t[msg][4] == true and not isPremium(cid) then npcHandler:say("Apenas Premium Players podem viajar à essa ilha, procure outra!!", cid) return false end if getPlayerLevel(cid) < t[msg][3] then npcHandler:say("Voce precisa ser level ".. tonumber(t[msg][3]) .." ou maior para viajar à essa ilha.", cid) return false end if getCreatureSkullType(cid) == 3 then npcHandler:say("PK's não podem viajar.", cid) return false end if doPlayerRemoveItem(cid, moeda, t[msg][1]) then doTeleportThing(cid, t[msg][2]) npcHandler:say("Obrigado! Espero que volte em breve.", cid) else npcHandler:say("Voce nao tem gold bars suficientes para viajar.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) XML <?xml version="1.0"?> <npc name="Minoru" script="data/npc/scripts/Minoru.lua" walkinterval="5000" floorchange="0"> <health now="100" max="100"/> <look type="407" head="95" body="116" legs="121" feet="115" addons="0"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. Deseja {viajar} ??" /> </parameters> </npc>
Postado Julho 26, 2018 6 anos Autor @Sttorm Infelizmente o problema ainda persiste, quando faço /n (nome do npc) aparece o erro e o npc nao aparece
Postado Julho 26, 2018 6 anos 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,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower() local tabble = { ["carlin"] = {item = {2160,1}, money = 1, level = 30, pos = {x = 1054, y = 1058, z = 7}}, ["thais"] = {item = {2190, 1}, money = 2000, level = 60, pos = {x = 168, y = 58, z = 7}} } if not tabble[msg] then npcHandler:say('somente posso te levar para {carlin} ou {thais}...', cid) return true end local t = tabble[msg] if getPlayerItemCount(cid, t.item[1]) >= t.item[2] then if getPlayerLevel(cid) >= t.level then if getPlayerMoney(cid) >= t.money then npcHandler:say('Você foi teleportado para '..msg..'!', cid) doTeleportThing(cid, t.pos) doPlayerRemoveMoney(cid, t.money) return true else npcHandler:say('Você precisa de '..t.money..' gold coins para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa ter '..t.level..' level ou mais para viajar para '..msg..'.', cid) end else npcHandler:say('Você precisa de '..t.item[2]..' '..getItemNameById(t.item[1])..' para viajar para '..msg..'.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.