Não levem a mau se tiver erro, esse e meu primeiro npc e tbm meu primeiro topico!
Vamos lah:
1º passo:
Abra a pasta do seu server, va até data/npc e copie qualquer pasta e cole e renomeie para "save e clean" (sem as paspas)
abra como bloco de notas e apage tudo que tiver dentro e cole isso:
<npc name="Save e Clean" script="data/npc/scripts/clean.lua" autowalk="25" floorchange="0" access="5" level="100" maglevel="100"> <health now="150" max="150"/> <look type="130" head="132" body="116" legs="116" feet="76" corpse="2212"/> <parameters> </parameters> </npc>
2º passo:
va ate data/npc/scripts copie qualquer arquivo e renomeie para "clean" (sem as paspas)
abra apage tudo que tiver dentro e bote 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('Ola ' .. creatureGetName(cid) .. '! Eu posso dar CLEAN e SAVE!') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! Aguarde.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'clean') then selfSay('/clean') elseif msgcontains(msg, 'save') then selfSay('/save') elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Tchau, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('E educado falar tchau antes de sair...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Bye Bye.') focus = 0 end end end
Pronto!
seu Npc esta pronto para ser usado!
---------------------------------------
Creditos todos a mim, eu que fiz tudo sozinho e por favor, nao copien e colem em otros foruns esse npc e meu!
Espero ter ajudado.