Ir para conteúdo

Featured Replies

Postado
local config = {

exhausttime = 7200, -- time in seconds

exhauststorage = 2301,

level = 50 -- level minimo para usar o book

}



function onUse(cid, item, fromPosition, itemEx, toPosition)



local rewarditems = {

{id = 2492, chance = 10, count = 1}, -- id da demon legs

{id = 2498, chance = 10, count = 1}, -- id da demon armor

{id = 2488, chance = 10, count = 1}, -- id do demon shield

{id = 2488, chance = 20, count = 1}, -- id do demon helmet

{id = 2488, chance = 50, count = 1} -- id stell boots

}



if getPlayerLevel(cid) < config.level then

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendCancel(cid, "Voce precisa estar ser level "..config.level.." para usar o livro.")

return true

end



if exhaustion.check(cid, config.exhauststorage) then

local time = exhaustion.get(cid, config.exhauststorage)

local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)

if time >= 3600 then

text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

elseif time >= 120 then

text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

else

text = seconds.." "..(seconds > 1 and "seconds" or "second")

end

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Esta vazio, voce precisa esperar "..text.." antes de usar o livro novamente.")

return true

end



local chance = math.random(1,100)

for i = 1, #rewarditems, 1 do

if chance < rewarditems[i].chance then

local info = getItemInfo(rewarditems[i].id)

if rewarditems[i].count > 1 then

text = rewarditems[i].count .. " " .. info.plural

else

                 text = info.article .. " " .. info.name

end



local item = doCreateItemEx(rewarditems[i].id, rewarditems[i].count)

if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

text = "Voce encontrou uma recompensa, mas voce nao tem cap ou espaco na bp para ganha-la."

else

text = "Voce encontrou " .. text .. "."

exhaustion.set(cid, config.exhauststorage, config.exhausttime)

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)

return true

else

chance = chance - rewarditems[i].chance

end

end

end

Tenta assim

  • Respostas 12
  • Visualizações 839
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • O script q te mandei nao funcionou?

  • local config = { exhausttime = 7200, -- time in seconds exhauststorage = 2301, level = 50 -- level minimo para usar o book } function onUse(cid, item, fromPosition, itemEx, toPosition) local

  • local config = { exhausttime = 7200, -- time in seconds exhauststorage = 2301, level = 50 -- level minimo para usar o book } function onUse(cid, item, fromPosition, itemEx, toPosition) local

Postado
  • Autor
1 minuto atrás, Kemmlly disse:

local config = {

exhausttime = 7200, -- time in seconds

exhauststorage = 2301,

level = 50 -- level minimo para usar o book

}



function onUse(cid, item, fromPosition, itemEx, toPosition)



local rewarditems = {

{id = 2492, chance = 10, count = 1}, -- id da demon legs

{id = 2498, chance = 10, count = 1}, -- id da demon armor

{id = 2488, chance = 10, count = 1}, -- id do demon shield

{id = 2488, chance = 20, count = 1}, -- id do demon helmet

{id = 2488, chance = 50, count = 1} -- id stell boots

}



if getPlayerLevel(cid) < config.level then

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendCancel(cid, "Voce precisa estar ser level "..config.level.." para usar o livro.")

return true

end



if exhaustion.check(cid, config.exhauststorage) then

local time = exhaustion.get(cid, config.exhauststorage)

local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)

if time >= 3600 then

text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

elseif time >= 120 then

text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

else

text = seconds.." "..(seconds > 1 and "seconds" or "second")

end

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Esta vazio, voce precisa esperar "..text.." antes de usar o livro novamente.")

return true

end



local chance = math.random(1,100)

for i = 1, #rewarditems, 1 do

if chance < rewarditems[i].chance then

local info = getItemInfo(rewarditems[i].id)

if rewarditems[i].count > 1 then

text = rewarditems[i].count .. " " .. info.plural

else

                 text = info.article .. " " .. info.name

end



local item = doCreateItemEx(rewarditems[i].id, rewarditems[i].count)

if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

text = "Voce encontrou uma recompensa, mas voce nao tem cap ou espaco na bp para ganha-la."

else

text = "Voce encontrou " .. text .. "."

exhaustion.set(cid, config.exhauststorage, config.exhausttime)

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)

return true

else

chance = chance - rewarditems[i].chance

end

end

end

Tenta assim

ainda o item não some

Postado

local config = {

exhausttime = 7200, -- time in seconds

exhauststorage = 2301,

level = 50 -- level minimo para usar o book

}



function onUse(cid, item, fromPosition, itemEx, toPosition)



local rewarditems = {

{id = 2492, chance = 10, count = 1}, -- id da demon legs

{id = 2498, chance = 10, count = 1}, -- id da demon armor

{id = 2488, chance = 10, count = 1}, -- id do demon shield

{id = 2488, chance = 20, count = 1}, -- id do demon helmet

{id = 2488, chance = 50, count = 1} -- id stell boots

}



if getPlayerLevel(cid) < config.level then

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendCancel(cid, "Voce precisa estar ser level "..config.level.." para usar o livro.")

return true

end



if exhaustion.check(cid, config.exhauststorage) then

local time = exhaustion.get(cid, config.exhauststorage)

local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)

if time >= 3600 then

text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

elseif time >= 120 then

text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

else

text = seconds.." "..(seconds > 1 and "seconds" or "second")

end

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Esta vazio, voce precisa esperar "..text.." antes de usar o livro novamente.")

return true

end



local chance = math.random(1,100)

for i = 1, #rewarditems, 1 do

if chance < rewarditems[i].chance then
doRemoveItem(item.uid, 1)

local info = getItemInfo(rewarditems[i].id)

if rewarditems[i].count > 1 then
doRemoveItem(item.uid, 1)

text = rewarditems[i].count .. " " .. info.plural

else

                 text = info.article .. " " .. info.name

end



local item = doCreateItemEx(rewarditems[i].id, rewarditems[i].count)

if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

text = "Voce encontrou uma recompensa, mas voce nao tem cap ou espaco na bp para ganha-la."

else

text = "Voce encontrou " .. text .. "."

exhaustion.set(cid, config.exhauststorage, config.exhausttime)

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)

return true

else

chance = chance - rewarditems[i].chance

end

end

end

 

Postado
  • Autor
4 minutos atrás, Kemmlly disse:


local config = {

exhausttime = 7200, -- time in seconds

exhauststorage = 2301,

level = 50 -- level minimo para usar o book

}



function onUse(cid, item, fromPosition, itemEx, toPosition)



local rewarditems = {

{id = 2492, chance = 10, count = 1}, -- id da demon legs

{id = 2498, chance = 10, count = 1}, -- id da demon armor

{id = 2488, chance = 10, count = 1}, -- id do demon shield

{id = 2488, chance = 20, count = 1}, -- id do demon helmet

{id = 2488, chance = 50, count = 1} -- id stell boots

}



if getPlayerLevel(cid) < config.level then

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendCancel(cid, "Voce precisa estar ser level "..config.level.." para usar o livro.")

return true

end



if exhaustion.check(cid, config.exhauststorage) then

local time = exhaustion.get(cid, config.exhauststorage)

local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)

if time >= 3600 then

text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

elseif time >= 120 then

text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

else

text = seconds.." "..(seconds > 1 and "seconds" or "second")

end

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Esta vazio, voce precisa esperar "..text.." antes de usar o livro novamente.")

return true

end



local chance = math.random(1,100)

for i = 1, #rewarditems, 1 do

if chance < rewarditems[i].chance then
doRemoveItem(item.uid, 1)

local info = getItemInfo(rewarditems[i].id)

if rewarditems[i].count > 1 then
doRemoveItem(item.uid, 1)

text = rewarditems[i].count .. " " .. info.plural

else

                 text = info.article .. " " .. info.name

end



local item = doCreateItemEx(rewarditems[i].id, rewarditems[i].count)

if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

text = "Voce encontrou uma recompensa, mas voce nao tem cap ou espaco na bp para ganha-la."

else

text = "Voce encontrou " .. text .. "."

exhaustion.set(cid, config.exhauststorage, config.exhausttime)

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)

return true

else

chance = chance - rewarditems[i].chance

end

end

end

 

agora o item some, mas quando o player está sem cap ao clika-lo o item some e ganha nada

Postado
local rewarditems = {

{id = 2492, chance = 10, count = 1}, -- id da demon legs

{id = 2498, chance = 10, count = 1}, -- id da demon armor

{id = 2488, chance = 10, count = 1}, -- id do demon shield

{id = 2488, chance = 20, count = 1}, -- id do demon helmet

{id = 2488, chance = 50, count = 1} -- id stell boots

}



if getPlayerLevel(cid) < config.level then

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendCancel(cid, "Voce precisa estar ser level "..config.level.." para usar o livro.")

return true

end



if exhaustion.check(cid, config.exhauststorage) then

local time = exhaustion.get(cid, config.exhauststorage)

local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)

if time >= 3600 then

text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

elseif time >= 120 then

text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")

else

text = seconds.." "..(seconds > 1 and "seconds" or "second")

end

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Esta vazio, voce precisa esperar "..text.." antes de usar o livro novamente.")

return true

end



local chance = math.random(1,100)

for i = 1, #rewarditems, 1 do

if chance < rewarditems[i].chance then
doRemoveItem(item.uid, 1)

local info = getItemInfo(rewarditems[i].id)

if rewarditems[i].count > 1 then
doRemoveItem(item.uid, 1)

text = rewarditems[i].count .. " " .. info.plural

else

                 text = info.article .. " " .. info.name

end



local item = doCreateItemEx(rewarditems[i].id, rewarditems[i].count)

if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

text = "Voce encontrou uma recompensa, mas voce nao tem cap ou espaco na bp para ganha-la."

else

text = "Voce encontrou " .. text .. "."

exhaustion.set(cid, config.exhauststorage, config.exhausttime)

end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)

return true

else

chance = chance - rewarditems[i].chance

end

end

end

 

Perdão, falha minha, é o sono, acredito que agora esteja certo.

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