Ir para conteúdo

Featured Replies

Postado
  • Autor
  Em 07/07/2016 em 02:30, Kemmlly disse:

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.

quer isso mano, eu que peço obrigado, agora se liga, faltou a parte de cima mas eu adicionei a parte de cima, 
aí quando você tá sem cap aparece a msg - Você não tem cap ou não tem espaço na backpack, mas o item some :( 

up

  • Respostas 12
  • Visualizações 837
  • 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
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
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	text = "Voce encontrou uma recompensa, mas voce nao tem cap ou espaco na bp para ganha-la."
	else
	local book = 1950
	doPlayerRemoveItem(cid, book, 1)
	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

 

Editado por Kemmlly (veja o histórico de edições)

Postado
  • Autor
  Em 07/07/2016 em 11:52, 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

}

local book = 1950

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

doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)

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

else

doPlayerRemoveItem(cid, book, 1)
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

 

Vish, item não some :( 

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