.Qual servidor ou website você utiliza como base?
TFS 1.2 8.0
Qual o motivo deste tópico?
ALGUEM SABE COMO FAZ NPC TROCAR ITEM POR OUTRO ITEM SO UMA VEZ NESSE SCRIPT PF?
Está surgindo algum erro? Se sim coloque-o aqui.
Você tem o código disponível? Se tiver publique-o 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
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'ghost coin') or msgcontains(msg, 'gsc')) then
selfSay('Você quer comprar 100 Ghost Coin\'s por 20kk ruby coins?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 13685) >= 20) then
doPlayerRemoveItem(cid, 13685, 20)
doPlayerAddItem(cid, 6527, 100)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,13685) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 20kk ruby coins.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'premium time') or msgcontains(msg, 'premium')) then
selfSay('Aceita trocar 100 Ghost Coins por 30 dias de premium?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if(getPlayerItemCount(cid, 6527) >= 100) then
doPlayerRemoveItem(cid, 6527, 100)
doPlayerAddPremiumDays(cid, 30)
doSendMagicEffect(getCreaturePos(cid), 14)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você recebeu 30 dias de premium time.")
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " ghost coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 100 Ghost Coin\'s.', cid)
end
talkState[cid] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'bless class a') or msgcontains(msg, 'bless')) then
selfSay('Você quer compra Bless Class A por 50 Ghost Coin?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
if getPlayerBlessing(cid, 1) then
selfSay('Você já tem a benção dos deuses.', cid)
return true
end
if(getPlayerItemCount(cid, 6527) >= 50) then
if getPlayerPremiumDays(cid) == 0 then
selfSay('Desculpe, mais você não tem premium.', cid)
return true
end
doPlayerRemoveItem(cid, 6527, 50)
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
doSendMagicEffect(getCreaturePos(cid), 49)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " ghost coin\'s.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você recebeu benção dos deuses class A.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 50 Ghost Coin.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'changesex') or msgcontains(msg, 'sex')) then
selfSay('Aceita trocar 100 Ghost Coin por uma cirurgia de troca de sexo?', cid)
talkState[talkUser] = 4
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
if(getPlayerItemCount(cid, 6527) >= 100) then
doPlayerRemoveItem(cid, 6527, 100)
doSendMagicEffect(getCreaturePos(cid), 14)
doPlayerSetSex(cid, getPlayerSex(cid) == PLAYERSEX_FEMALE and PLAYERSEX_MALE or PLAYERSEX_FEMALE)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce trocou de sexo com sucesso.")
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 100 Ghost Coin.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'Frags') or msgcontains(msg, 'Remover Frags')) then
selfSay('Você quer comprar um removedor de frags por 100 Ghost Coin\'s?', cid)
talkState[talkUser] = 5
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 5) then
if(getPlayerItemCount(cid, 6527) >= 100) then
doPlayerRemoveItem(cid, 6527, 100)
doSendMagicEffect(getCreaturePos(cid), 56)
db.query('UPDATE `killers`, `player_killers` SET `killers`.`unjustified` = 0 WHERE `killers`.`unjustified` = 1 AND `player_killers`.`player_id` = ' .. getPlayerGUID(cid) .. ' AND `killers`.`id` = `player_killers`.`kill_id`')
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Suas Frags foi retirada.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 100 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'concentrated demonic blood') or msgcontains(msg, 'demoniac')) then
selfSay('Você quer comprar concentrated demonic blood por 50 Ghost Coin\'s?', cid)
talkState[talkUser] = 6
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6) then
if(getPlayerItemCount(cid, 6527) >= 50) then
doPlayerRemoveItem(cid, 6527, 50)
doPlayerAddItem(cid, 6558)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 50 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'blood of gods') or msgcontains(msg, 'blood')) then
selfSay('Aceita trocar 70 Ghost Coins por 1 Backpack com 20 Blood of God\'s? (Requerido 1550 de cap)', cid)
talkState[talkUser] = 7
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 7) then
if(getPlayerItemCount(cid, 6527) >= 70) then
doPlayerRemoveItem(cid, 6527, 70)
doPlayerAddItem(cid, 14454, 20)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 70 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'addon doll') or msgcontains(msg, 'addon doll')) then
selfSay('você quer compra 1 addon doll por 100 Ghost Coin\'s.', cid)
talkState[talkUser] = 8
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 😎 then
if(getPlayerItemCount(cid, 6527) >= 50000) then
doPlayerRemoveItem(cid, 6527, 50000)
doPlayerAddItem(cid, 9693, 1)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 100 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'teleport') or msgcontains(msg, 'teleport')) then
selfSay('Aceita trocar 25 Ghost Coins por 10 Teleports? (Requerido 10 de cap).', cid)
talkState[talkUser] = 9
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 9) then
if(getPlayerItemCount(cid, 6527) >= 25) then
doPlayerRemoveItem(cid, 6527, 25)
doPlayerAddItem(cid,13691, 10)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 25 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'small elixir of experience') or msgcontains(msg, 'small elixir')) then
selfSay('Aceita trocar 30 Ghost Coins por 50 Small Elixir of Experience? (Requerido 60 de cap)', cid)
talkState[talkUser] = 10
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 10) then
if(getPlayerItemCount(cid, 6527) >= 30) then
doPlayerRemoveItem(cid, 6527, 30)
doPlayerAddItem(cid, 13692, 50)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 30 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'normal elixir of experiences') or msgcontains(msg, 'normal elixir of experience')) then
selfSay('Aceita trocar 50 Ghost Coins por 50 Normal Elixir of Experience? (Requerido 160 de cap)', cid)
talkState[talkUser] = 11
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 11) then
if(getPlayerItemCount(cid, 6527) >= 50) then
doPlayerRemoveItem(cid, 6527, 50)
doPlayerAddItem(cid, 13693, 50)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 50 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'mana fluid') or msgcontains(msg, 'mfs')) then
selfSay('Aceita trocar 15 Ghost Coins por 1 Large Mana Fluid com 100 cargas? (Requerido 100 de cap)', cid)
talkState[talkUser] = 12
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 12) then
if(getPlayerItemCount(cid, 6527) >= 15) then
doPlayerRemoveItem(cid, 6527, 15)
doPlayerAddItem(cid, 14456, 100)
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 15 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'destroy field') or msgcontains(msg, 'destroy')) then
selfSay('Aceita trocar 5 Ghost Coins por 1 bp com 20 runas de 60x de destroy field? (Requerido 45 de cap)', cid)
talkState[talkUser] = 13
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 13) then
if(getPlayerItemCount(cid, 6527) >= 5) then
doPlayerRemoveItem(cid, 6527, 5)
doPlayerAddItem(cid, 2261, 60)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ghost Coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 5 Ghost Coin\'s.', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'uh') or msgcontains(msg, 'uhs')) then
selfSay('Aceita trocar 10 Ghost Coins por 1 bp com 20 runas de 20x de uh? (Requerido 45 de cap).', cid)
talkState[talkUser] = 14
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 14) then
if(getPlayerItemCount(cid, 6527) >= 10) then
doPlayerRemoveItem(cid, 6527, 10)
doPlayerAddItem(cid, 2273, 20)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 10 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
---------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'dark explo') or msgcontains(msg, 'dexlo')) then
selfSay('Aceita trocar 15 Ghost Coins por 1 bp com 1 runa de 200x de dark explosion? (Requerido 45 de cap).', cid)
talkState[talkUser] = 15
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 15) then
if(getPlayerItemCount(cid, 6527) >= 15) then
doPlayerRemoveItem(cid, 6527, 15)
doPlayerAddItem(cid, 2313, 200)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 15 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
-------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'dark sd') or msgcontains(msg, 'dsd')) then
selfSay('Aceita trocar 50 Ghost Coins por 1 bp com 1 runa de 200x de dsd? (Requerido 45 de cap).', cid)
talkState[talkUser] = 16
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 16) then
if(getPlayerItemCount(cid, 6527) >= 50) then
doPlayerRemoveItem(cid, 6527, 50)
doPlayerAddItem(cid, 2267, 200)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 50 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
---------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'gfb') or msgcontains(msg, 'gfbs')) then
selfSay('Aceita trocar 10 Ghost Coins por 1 bp com 20 runas de 40x de gfb? (Requerido 45 de cap).', cid)
talkState[talkUser] = 17
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 17) then
if(getPlayerItemCount(cid, 6527) >= 10) then
doPlayerRemoveItem(cid, 6527, 10)
doPlayerAddItem(cid, 2304, 20)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 10 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
--------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'hmm') or msgcontains(msg, 'hmms')) then
selfSay('Aceita trocar 5 Ghost Coins por 1 bp com 20 runas de 100x de hmm? (Requerido 45 de cap).', cid)
talkState[talkUser] = 18
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 18) then
if(getPlayerItemCount(cid, 6527) >= 5) then
doPlayerRemoveItem(cid, 6527, 5)
doPlayerAddItem(cid, 2311, 20)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 5 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'life ring') or msgcontains(msg, 'lifsing')) then
selfSay('Aceita trocar 10 Ghost Coins por 1 bp com 20 life rings? (Requerido 35 de cap).', cid)
talkState[talkUser] = 19
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 19) then
if(getPlayerItemCount(cid, 6527) >= 10) then
doPlayerRemoveItem(cid, 6527, 10)
doPlayerAddItem(cid, 2168, 20)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 10 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
-----------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'ring of healing') or msgcontains(msg, 'ring of healings')) then
selfSay('Aceita trocar 20 Ghost Coins por 1 bp com 20 ring of healings? (Requerido 35 de cap).', cid)
talkState[talkUser] = 20
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 20) then
if(getPlayerItemCount(cid, 6527) >= 20) then
doPlayerRemoveItem(cid, 6527, 20)
doPlayerAddItem(cid, 2214, 20)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 20 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
----------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'blessed ring') or msgcontains(msg, 'blessed rings')) then
selfSay('Aceita trocar 40 Ghost Coins por 1 bp com 20 Blessed rings? (Requerido 170 de cap).', cid)
talkState[talkUser] = 21
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 21) then
if(getPlayerItemCount(cid, 6527) >= 40) then
doPlayerRemoveItem(cid, 6527, 40)
doPlayerAddItem(cid, 13688, 20)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 40 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
-----------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'fighting spirit') or msgcontains(msg, 'fs')) then
selfSay('Aceita trocar 20 Ghost Coins por 1 Fighting Spirit? (Requerido 2 de cap).', cid)
talkState[talkUser] = 22
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 22) then
if(getPlayerItemCount(cid, 6527) >= 20) then
doPlayerRemoveItem(cid, 6527, 20)
doPlayerAddItem(cid, 4863, 1)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 20 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
--------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'energetico') or msgcontains(msg, 'energeticos')) then
selfSay('Aceita trocar 20 Ghost Coins por 1 Energético? (Requerido 30 de cap).', cid)
talkState[talkUser] = 23
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 23) then
if(getPlayerItemCount(cid, 6527) >= 20) then
doPlayerRemoveItem(cid, 6527, 20)
doPlayerAddItem(cid, 6106, 1)
doPlayerSendTextMessage(cid, 27,"Ainda lhe resta " .. getPlayerItemCount(cid,6527) .. " Ruby coin\'s.")
selfSay('Obrigado e volte sempre.', cid)
else
selfSay('Você não tem 20 Ghost Coin\'s..', cid)
end
talkState[talkUser] = 0
-------------------------------------------------------------------------------------------------------------------------------------------------
elseif(msgcontains(msg, 'offer') or msgcontains(msg, 'trade') or msgcontains(msg, 'ofertas')) then
selfSay('Eu vendo {Ghost Coins}, {premium time},{remove frags}, {blessed ring e rings etc}, {addon doll}, {teleport}, {concentrated demonic blood}, {blessing class A}, {normal elixir of experience}, {small elixir of experience} e {blood of gods}. e cirugia de sexo {change sex}.', cid)
selfSay('Eu vendo liquidos, grandes de {mana potion},{energetico} e de {health potion}.{runas, dark sd, dark explo, destroyer, gfb, uh, hmm etc.}.',cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.