Ir para conteúdo

Featured Replies

Postado
  • Solução
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,msg,str = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,msg:lower(),""
	local moeda = 10581 -- ID DA SILVER TOKEN 
	local t = {
		["boots of haste"] = {amount = 10, item = {2195,1}},
		["demon helmet"] = {amount = 11, item = {2493,1}},
		["frozen starlight"] = {amount = 30, item = {2361,1}},
		["spellbook of dark mysteries"] = {amount = 20, item = {8918,1}},
		["royal crossbow"] = {amount = 20, item = {8851,1}},
		["stuffed dragon"] = {amount = 30, item = {5791,1}},
		["star tear"] = {amount = 100, item = {7735,1}},
		["jester staff"] = {amount = 100, item = {7958,1}},
		["vancini axe"] = {amount = 100, item = {8925,1}},
		["firewalker boots"] = {amount = 50, item = {9932,1}},
		["flame blade"] = {amount = 100, item = {8931,2}}
	}
	
	if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
		str = str .. "Pode trocar suas SILVER TOKENS por: "
		for name, ret in pairs(t) do
			str = str.." {"..name.."} = "..ret.amount.." Moedas /"
		end
		npcHandler:say(str, cid)
	elseif t[msg] then
		local item, amount = t[msg].item[1], t[msg].item[2]
		if doPlayerRemoveItem(cid,moeda, t[msg].amount) then
			if isItemStackable(item) or amount == 1 then
				doPlayerAddItem(cid, item, amount)
			else
				for i = 1, amount do
					doPlayerAddItem(cid, item, 1)
				end
			end
			npcHandler:say("Aqui está "..amount.." ".. getItemNameById(item) .."!", cid)
		else
			npcHandler:say("Você precisa de "..t[msg].amount.." ".. getItemNameById(moeda), cid)
		end
	end 
	return true 
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

 

 

 

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

  • Respostas 9
  • Visualizações 3.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:o

  • eu fiz pra 8.6 na vdd

Postado
48 minutos atrás, Vodkart disse:

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,msg,str = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid,msg:lower(),""
	local moeda = 10581 -- ID DA SILVER TOKEN 
	local t = {
		["boots of haste"] = {amount = 10, item = {2195,1}},
		["demon helmet"] = {amount = 11, item = {2493,1}},
		["frozen starlight"] = {amount = 30, item = {2361,1}},
		["spellbook of dark mysteries"] = {amount = 20, item = {8918,1}},
		["royal crossbow"] = {amount = 20, item = {8851,1}},
		["stuffed dragon"] = {amount = 30, item = {5791,1}},
		["star tear"] = {amount = 100, item = {7735,1}},
		["jester staff"] = {amount = 100, item = {7958,1}},
		["vancini axe"] = {amount = 100, item = {8925,1}},
		["firewalker boots"] = {amount = 50, item = {9932,1}},
		["flame blade"] = {amount = 100, item = {8931,2}}
	}
	
	if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then
		str = str .. "Pode trocar suas SILVER TOKENS por: "
		for name, ret in pairs(t) do
			str = str.." {"..name.."} = "..ret.amount.." Moedas /"
		end
		npcHandler:say(str, cid)
	elseif t[msg] then
		local item, amount = t[msg].item[1], t[msg].item[2]
		if doPlayerRemoveItem(cid,moeda, t[msg].amount) then
			if isItemStackable(item) or amount == 1 then
				doPlayerAddItem(cid, item, amount)
			else
				for i = 1, amount do
					doPlayerAddItem(cid, item, 1)
				end
			end
			npcHandler:say("Aqui está "..amount.." ".. getItemNameById(item) .."!", cid)
		else
			npcHandler:say("Você precisa de "..t[msg].amount.." ".. getItemNameById(moeda), cid)
		end
	end 
	return true 
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) 
npcHandler:addModule(FocusModule:new())

 

 

 

 

Funciona com 8.6 ?

  • 2 months later...

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo