Postado Dezembro 8, 2016 8 anos Tente novamente Spoiler local items = { [5468] = {maxAmmount = 1, chance = 50}, [8982] = {maxAmmount = 1, chance = 50}, [10310] = {maxAmmount = 1, chance = 50}, [2829] = {maxAmmount = 1, chance = 50}, } function onUse(cid, item) for i, e in pairs(items) do if math.random(200) <= e.chance then local ammount = math.random(e.maxAmmount) doPlayerAddItem(cid, i, ammount) doPlayerSendTextMessage(cid, 22, "Voce ganhou "..ammount.."x "..getItemNameById(i)) end end doRemoveItem(item.uid) return true end
Postado Dezembro 8, 2016 8 anos Autor 4 minutos atrás, PedroSTT disse: Tente novamente Ocultar conteúdo local items = { [5468] = {maxAmmount = 1, chance = 50}, [8982] = {maxAmmount = 1, chance = 50}, [10310] = {maxAmmount = 1, chance = 50}, [2829] = {maxAmmount = 1, chance = 50}, } function onUse(cid, item) for i, e in pairs(items) do if math.random(200) <= e.chance then local ammount = math.random(e.maxAmmount) doPlayerAddItem(cid, i, ammount) doPlayerSendTextMessage(cid, 22, "Voce ganhou "..ammount.."x "..getItemNameById(i)) end end doRemoveItem(item.uid) return true end Testado, agora esta falhando muito, de 5 box 2 dropa o iten.. e agora ta vindo de 2 em 2
Postado Dezembro 8, 2016 8 anos Tente novamente ;P Spoiler local items = { [5468] = {maxAmmount = 1, chance = 50}, [8982] = {maxAmmount = 1, chance = 50}, [10310] = {maxAmmount = 1, chance = 50}, [2829] = {maxAmmount = 1, chance = 50}, } function onUse(cid, item) for i, e in pairs(items) do if math.random(100) == e.chance then local ammount = math.random(1) doPlayerAddItem(cid, i, ammount) doPlayerSendTextMessage(cid, 22, "Voce ganhou "..ammount.."x "..getItemNameById(i)) end end doRemoveItem(item.uid) return true end
Postado Dezembro 8, 2016 8 anos Autor Se um dia alguem precisar, encontrei esse scripts no TK, e esta funcionando 100% do jeito que eu queria!! Obrigado @PedroSTT, pela ajudaaaa -- script Pokemon NoX ---- function onUse(cid, item, itemEx, toPosition, fromPosition) item = 2366 item1 = 10310 item2 = 2829 item3 = 5468 item4 = 8982 efeito = 12 -- efeito ao receber itens i = 8110 if doPlayerRemoveItem(cid, i, 1) then if math.random(100) < 10 then -- ali no caso no numero 20 é a chance, esse 10 significa 10% os que tiver 10 são os itens raros doPlayerAddItem(cid, item, 1) doPlayerSendTextMessage(cid, 22, "você ganhou Stamina Potion") --- coloque o nome dos itens que o cara ganhar doSendMagicEffect(getCreaturePosition(cid), efeito) else if math.random(100) < 50 then doPlayerAddItem(cid, item1, 1) doPlayerSendTextMessage(cid, 22, "você ganhou Donate 1 Dia") doSendMagicEffect(getCreaturePosition(cid), efeito) else if math.random(100) < 20 then doPlayerAddItem(cid, item2, 1) doPlayerSendTextMessage(cid, 22, "você ganhou Scroll 45 Level") doSendMagicEffect(getCreaturePosition(cid), efeito) else if math.random(100) < 90 then doPlayerAddItem(cid, item3, 1) doPlayerSendTextMessage(cid, 22, "você ganhou 2x Exp Potion") doSendMagicEffect(getCreaturePosition(cid), efeito) else if math.random(100) < 70 then doPlayerAddItem(cid, item4, 1) doPlayerSendTextMessage(cid, 22, "você ganhou Divino DOll") doSendMagicEffect(getCreaturePosition(cid), efeito) -- se for adicionar mais else if math.random... tem que adicionar um end no final end end end end end end return true end Editado Dezembro 8, 2016 8 anos por mateusmoretti (veja o histórico de edições)
Postado Dezembro 8, 2016 8 anos Bom , agora que não está dando , resolvi pegar uma do forum mesmo SCRIPT Spoiler ----- Random Box By EddyHavoc ----- function onUse(cid, item, frompos, item2, topos) r1 = math.random(1,5) if getPlayerLevel(cid) >= 60 then if doPlayerRemoveItem(cid,29397,1) == TRUE then if r1 == 1 then doPlayerSendTextMessage(cid,22,"Você ganhou uma Eletric Bike.") doPlayerAddItem(cid,29393,1) elseif r1 == 2 then doPlayerSendTextMessage(cid,22,"Você ganhou uma Water Bike.") doPlayerAddItem(cid,29394,1) elseif r1 == 3 then doPlayerSendTextMessage(cid,22,"Você ganhou uma Leaf Bike.") doPlayerAddItem(cid,29395,1) elseif r1 == 4 then doPlayerSendTextMessage(cid,22,"Você ganhou um Fire Bike.") doPlayerAddItem(cid,29396,1) elseif r1 == 5 then doPlayerSendTextMessage(cid,22,"Você ganhou um Tradicional Bike.") doPlayerAddItem(cid,14659,1) end end end end XML Spoiler <action itemid="ID Da Bike Box" event="script" value="Bike Box.lua"/> Créditos : SkyFrozer EddyHavoc
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.