Postado Julho 7, 2016 8 anos 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 Meu servidor https://www.facebook.com/Heavennoobwar
Postado Julho 7, 2016 8 anos 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 Julho 7, 2016 8 anos por Kemmlly (veja o histórico de edições)
Postado Julho 7, 2016 8 anos 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 Meu servidor https://www.facebook.com/Heavennoobwar
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.