upking 14 Postado Julho 17, 2007 Share Postado Julho 17, 2007 Antes se você pedisse 100 runes ele ia te dar 100 runas de 1x agora vc pode pedir ate 100 runes que vai te dar 1 de 100x se vc falar 29 sd ele vai te dar 1 runa de 29x axo que entenderam né? ai vai Se ja postaram me desculpem. -- Npc by Zorzin =) --Bug das runas resolvidor por Upking 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) -- greeting phrase if string.find(msg, '(%a*)hi(%a*)') and focus == 0 and string.len(msg) == 2 and getDistanceToCreature(cid) < 4 then selfSay('Hi ' .. creatureGetName(cid) .. '! I sell runes.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.') elseif focus == cid then talk_start = os.clock() -- Mensages: buy_error = 'Sorry, you dont have enough money.' buy_ok = 'Here you are.' buy_no = 'Ok. Maybe another time.' -- sell_error = 'Sorry, you dont have that item.' sell_ok = 'Thanks for this item.' sell_no = 'Ok. Maybe another time.' -- preco_hmm = getConfigNumber("price_hmm") cargas_hmm = getConfigNumber("charges_hmm") preco_uh = getConfigNumber("price_uh") cargas_uh = getConfigNumber("charges_uh") preco_gfb = getConfigNumber("price_gfb") cargas_gfb = getConfigNumber("charges_gfb") preco_explo = getConfigNumber("price_explo") cargas_explo = getConfigNumber("charges_explo") preco_gfb = getConfigNumber("price_gfb") cargas_gfb = getConfigNumber("charges_gfb") preco_sd = getConfigNumber("price_sd") cargas_sd = getConfigNumber("charges_sd") if msgcontains(msg, 'rune') or msgcontains(msg, 'runes') then selfSay('I sell hmms ('.. preco_hmm ..'gps), uhs ('.. preco_uh ..'gps), gfbs ('.. preco_gfb ..'gps), explosions ('.. preco_explo ..'gps), sds '.. preco_sd ..'gps) and blank runes (5gps).') elseif msgcontains(msg, 'hmm') or msgcontains(msg, 'hmms') or msgcontains(msg, 'heavy magic missile') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2311,getCountNumber(msg),cargas_hmm,preco_hmm,1,'a','heavy magic missile rune','heavy magic missile runes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 392 elseif msgcontains(msg, 'uh') or msgcontains(msg, 'uhs') or msgcontains(msg, 'ultimate healing') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2273,getCountNumber(msg),cargas_uh,preco_uh,1,'an','ultimate healing rune','ultimate healing runes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 392 elseif msgcontains(msg, 'gfb') or msgcontains(msg, 'gfbs') or msgcontains(msg, 'great fireball') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2304,getCountNumber(msg),cargas_gfb,preco_gfb,1,'a','great fireball rune','great fireball runes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 392 elseif msgcontains(msg, 'explo') or msgcontains(msg, 'explosion') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2313,getCountNumber(msg),cargas_explo,preco_explo,1,'an','explosion rune','explosion runes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 392 elseif msgcontains(msg, 'sd') or msgcontains(msg, 'sds') or msgcontains(msg, 'sudden death') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2268,getCountNumber(msg),cargas_sd,preco_sd,1,'a','sudden death rune','sudden death runes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 392 elseif msgcontains(msg, 'blank') then bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2260,getCountNumber(msg),0,5,1,'a','blank rune','blank runes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 392 elseif talk_state == 392 then if msgcontains(msg, 'yes') or msgcontains(msg, 'no') then if bs == 'buy' then buyItem(cid,itemid,count,subtype,price,iscountable,name,plural,buy_error,buy_ok,buy_ no,msg) else sellItem(cid,itemid,count,subtype,price,iscountable,sell_error,sell_ok,sell_no,msg) end talk_state = 0 end elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then selfSay('Good bye, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if focus > 0 then x, y, z = creatureGetPosition(focus) myx, myy, myz = selfGetPosition() if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then selfTurn(1) end if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then selfTurn(3) end if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then selfTurn(2) end if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then selfTurn(0) end if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(2) end if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then selfTurn(0) end if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(3) end if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then selfTurn(1) end if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(2) end if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then selfTurn(0) end if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(3) end if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then selfTurn(1) end if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(2) end if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then selfTurn(0) end if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(3) end if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then selfTurn(1) end end if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Next Please...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Good bye then.') focus = 0 end end end vou explicar aqui qual era o problema. pequei de exemplo a sd estava desse jeito: elseif msgcontains(msg, 'sd') or msgcontains(msg, 'sds') or msgcontains(msg, 'sudden death') thenbs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2268,getCountNumber(msg),cargas_sd,preco_sd,0,'a','sudden death rune','sudden death runes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 392 acontece que desse jeito ele dizia que o item era incontavel. ai eu modifiquei e deixei assim: elseif msgcontains(msg, 'sd') or msgcontains(msg, 'sds') or msgcontains(msg, 'sudden death') thenbs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2268,getCountNumber(msg),cargas_sd,preco_sd,1,'a','sudden death rune','sudden death runes' sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs) talk_state = 392 assim eu o npc sabe que é contavel,agrupavel entao ele vende em 22x 39x qnts x o player pedir espero ter postado na seção correta se nao for esta movam o tópico por favor. Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados