Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

Rev 3777  0.4 8.60

Qual o motivo deste tópico? 

Preciso que nesse Script o NPC Atribua um valor na storage e alem disso ir somando, a cada troca ele tem que dar +15 de valor na storage.  
Exemplo: Storage é a 176602,  a cada troca que o player fazer ele ganha +15. então se são 5 trocas, ele vai ficar com Storage=176602, 75.
Ai se for possivel queria que o player ganhasse o valor só na primeira troca de cada item.

 

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 playerHaveItems(cid, itemid)
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
if getPlayerItemCount(cid, items[i]) <= 0 then
return false
end
end
return true
end

function doPlayerRemoveItems(cid, itemid, count)
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
doPlayerRemoveItem(cid, items[i], count ~= nil and count or 1)
end
return nil
end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then
return false
end

if msgcontains(msg, "Green Helmet") then
if playerHaveItems(cid, {12915, 12635}) then
doPlayerRemoveItems(cid, {12915}, 50)
doPlayerRemoveItems(cid, {12635}, 1)
doPlayerAddItem(cid, 7902, 1)
setPlayerStorageValue(cid,176602,15)
else
selfSay("Voce precisa de 50 Blue stone shard e 1 Shenlong Blue Helmet.")
end

elseif msgcontains(msg, "Green Armor") then
if playerHaveItems(cid, {12915, 12636}) then
doPlayerRemoveItems(cid, {12915}, 50)
doPlayerRemoveItems(cid, {12636}, 1)
doPlayerAddItem(cid, 7884, 1)
setPlayerStorageValue(cid,176602,15)
else
selfSay("Voce precisa de 50 Blue stone shard e 1 Shenlong Blue Armor.")
end

elseif msgcontains(msg, "Green Legs") then
if playerHaveItems(cid, {12915, 12637}) then
doPlayerRemoveItems(cid, {12915}, 50)
doPlayerRemoveItems(cid, {12637}, 1)
doPlayerAddItem(cid, 7885, 1)
setPlayerStorageValue(cid,176602,15)
else
selfSay("Voce precisa de 50 Blue stone shard e 1 Shenlong Blue legs.")
end

elseif msgcontains(msg, "Green Boots") then
if playerHaveItems(cid, {12915, 12638}) then
doPlayerRemoveItems(cid, {12915}, 50)
doPlayerRemoveItems(cid, {12638}, 1)
doPlayerAddItem(cid, 7886, 1)
setPlayerStorageValue(cid,176602,15)
else
selfSay("Voce precisa de 50 Blue stone shard e 1 Shenlong Blue Boots.")
end

elseif msgcontains(msg, "Green Shield") then
if playerHaveItems(cid, {12915, 12639}) then
doPlayerRemoveItems(cid, {12915}, 50)
doPlayerRemoveItems(cid, {12639}, 1)
doPlayerAddItem(cid, 7900, 1)
setPlayerStorageValue(cid,176602,15)
else
selfSay("Voce precisa de 50 Blue stone shard e 1 Shenlong Blue Shield.")
end

end 
return true

end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

 

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 520k

Informação Importante

Confirmação de Termo