Postado Janeiro 12, 2019 6 anos Olá, eu estou querendo uma script para passar por tiles pagando o npc se alguém me ajudar agradeço.
Postado Janeiro 12, 2019 6 anos Movements arquivo.lua: function onStepIn(cid, item, position, fromPosition) if getPlayerStorageValue(cid, DEKU) <= 0 then doTeleportThing(cid, fromPosition, true) doPlayerSendCancel(cid, "Você não tem permissão para passar.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Bem vindo ".. getCreatureName(cid) .."!") return true end movements.xml: <movevent type="StepIn" uniqueid="25641" event="script" value="arquivo.lua"/> em data/npc/ crie um arquivo.xml com o nome que desejar e cole isso dentro: <npc name="Nome do NPC" script="data/npc/scripts/arquivo.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="5" head="132" body="79" legs="97" feet="132" corpse="2212"/> </npc> em data/npc/script crie um arquivo.lua e cole isso: local focus = 0 local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Good bye then.') focus = 0 talk_start = 0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end function onCreatureSay(cid, type, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá ' .. getCreatureName(cid) .. '! gostaria de comprar acesso para passar no tile?') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Estou ocupado.') elseif focus == cid then talk_start = os.clock() elseif msgcontains(msg, 'yes') then if doPlayerRemoveMoney(cid,10000) == 1 then selfSay('Ótimo, agora você podera passar') setPlayerStorageValue(cid,DEKU,1) else selfSay('Você não tem dinheiro o suficiente.') end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Adeus ' .. creatureGetName(cid) .. ', Volte Sempre.') focus = 0 talk_start = 0 elseif msg ~= "" then selfSay('Como? Eu não entendi!') talk_state = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() doNpcSetCreatureFocus(focus) if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Proximo!!...') end focus = 0 talk_start = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Good Bye') focus = 0 talk_start = 0 end end end Editado Janeiro 12, 2019 6 anos por Yan Liima (veja o histórico de edições) ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
Postado Janeiro 12, 2019 6 anos Autor @Yan Liima o negocio de não conseguir passar na area funcionou, mas o npc está bugado primeiro veio com um error por ter um end a mais e agr eu não consigo responder ele em nenhum chat ele só responde o "hi" e não abre o chat de npcs automaticamente
Postado Janeiro 12, 2019 6 anos 1 hora atrás, DEKU KUNNNN disse: @Yan Liima o negocio de não conseguir passar na area funcionou, mas o npc está bugado primeiro veio com um error por ter um end a mais e agr eu não consigo responder ele em nenhum chat ele só responde o "hi" e não abre o chat de npcs automaticamente Troque aquele NPC por este, xml: <?xml version="1.0" encoding="UTF-8"?> <npc name="Nome do NPC" script="arquivo.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1"> <health now="100" max="100"/> <look type="812" head="132" body="79" legs="97" feet="132" corpse="2212"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|! gostaria de comprar acesso para passar no tile?"/> <parameter key="message_farewell" value="Good bye, |PLAYERNAME|!"/> </parameters> </npc> arquivo.lua local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg:lower()) end function onThink() npcHandler:onThink() end local talkState = {} function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, "yes") then if doPlayerRemoveMoney(cid,10000) == 1 then selfSay("Ótimo, agora você podera passar", cid) setPlayerStorageValue(cid,DEKU,1) else selfSay("Você não tem dinheiro o suficiente.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
Postado Janeiro 12, 2019 6 anos Autor @Yan Liima Testando @Yan Liima o primeiro error já arrumei agr está dando esse:
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.