- 0
Script Itens,vc Compra Do Npc
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
script alguém pode me ajudar nessa spells aqui, queira que colocassem pro meu personagem ficar inatingível por 6 segundos e podendo atacar livremente
Por lazaroszz,
- 0 respostas
- 1049 visualizações
-
- 3 respostas
- 4340 visualizações
-
- 2 respostas
- 1955 visualizações
-
- 1 resposta
- 1647 visualizações
-
- 1 resposta
- 1781 visualizações
-

Pergunta
Lucaswc15 20
Ae galera preciso que esse script aki, em vez de eu vender pro npc, eu quero q o npc venda pra mim pois vou usar isso em outro script aqui
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 function getNumber(txt) x = string.gsub(txt,"%a","") x = tonumber(x) if x ~= nill and x > 0 then return x else return 0 end end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid items = { ["bunch of ripe rice"] = {id = 11239, price = 75}, ["scythe leg"] = {id = 11223, price = 450}, ["fiery heart"] = {id = 10552, price = 375}, ["boggy dreads"] = {id = 10583, price = 200}, ["centipede leg"] = {id = 11212, price = 28}, ["wyrm scale"] = {id = 10581, price = 400}, ["essence of a bad dream"] = {id = 11217, price = 360}, ["ghastly dragon head"] = {id = 11360, price = 700}, ["gland"] = {id = 8971, price = 500}, ["half digested piece of meat"] = {id = 11194, price = 55}, ["half eaten brain"] = {id = 10575, price = 85}, ["hellhound slobber"] = {id = 10553, price = 500}, ["lizard essence"] = {id = 12597, price = 300}, ["mutated flesh"] = {id = 11219, price = 50}, ["mutated rat tail"] = {id = 10584, price = 150}, ["book of necromantic rituals"] = {id = 11231, price = 250}, ["petrified scream"] = {id = 11331, price = 250}, ["tarantula egg"] = {id = 11192, price = 80}, ["undead heart"] = {id = 11361, price = 200}, ["broken halberd"] = {id = 11329, price = 100}, ["cursed shoulder spikes"] = {id = 11321, price = 320}, ["legionnaire flags"] = {id = 11328, price = 500}, ["spiked iron ball"] = {id = 11319, price = 100} } msg = string.lower(msg) if not talkState[talkUser] and not items[msg] then selfSay('eu não compro este item!', cid) elseif items[msg] then selfSay('Compro cada '..msg..' por '..items[msg].price..' golds, quer me vender quantos desse item?', cid) index,var = items[msg].id,items[msg].price talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if getNumber(msg) > 0 and getNumber(msg) < 101 then n = getNumber(msg) selfSay('Você quer vender '..n..' '..getItemNameById(index)..' por '..var*n..' golds?', cid) talkState[talkUser] = 2 else selfSay('Compro no m\ínimo 1 e no m\áximo 100 desse item!', cid) end elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then if doPlayerRemoveItem(cid, index, n) then doPlayerAddMoney(cid, var*n) selfSay('Muito obrigado, aqui está seu dinheiro!', cid) else selfSay('você não tem os items!', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("tudo bem então.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())Script By: Vodkart, modificado por mim.
@EDIT
JA CONSEGUI FAZER O SCRIPT SOZINHO
PODEM FECHAR O TOPICO
OBRIGADO.
Editado por Lucaswc15Link para o comentário
https://xtibia.com/forum/topic/186481-script-itensvc-compra-do-npc/Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados