Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Estava precisando de um item, "gnomish supply package". ao ser usado, você ganha aleatoriamente um de 24 items.

Procurei e não encontrei. Lembrei do item, "winning lottery ticket". Fiz modificações para me satisfazer.

Créditos Desconhecido.

Porque já estava incluído no servidor Global 9.81 do TK.

2% Shumagora

Então vamo lá:

data/actions/actions.xml

<action itemid="18215" event="script" value="Gnomish.lua"/>
itemid="18215" -> id do item ao ser usado data/actions/scripts/Gnomish.lua
if rand == 0 then

elseif rand == 1 then

elseif rand == 2 then
... etc... são os números "do sorteio". que ao clicar no item aparecerá um item de 0 a 24 como no exemplo acima.
 doCreatureSay(cid, "You have a 15 Crystalline Arrows!", TALKTYPE_ORANGE_1)
Mensagem quando aparece o item. doPlayerAddItem(cid, 2154,1) -> id do item, quantidade caso você queira adicionar mais items, é só da ctrl+c mais ctrl+v e editar:
elseif rand == 24 then

doCreatureSay(cid, "You have a Yellow Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2154,1)

doRemoveItem(cid, item.uid, 1)
Você edita elseif rand == 24 then e coloca: elseif rand == 25 then e edita o resto. (não se esqueça de editar math.random(0, 24) para (0, 25) se quiser deixar para que ele quebre também

Suponhamos que: "mega sena tem 0 a 40 números. você joga os dados e reza pra não cair acima de 24, porque não ganhará premio algum.

É bem isso ai, poste suas dúvidas, que ano vem respondo = )

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


local rand = math.random(0, 24)

local lotteryid = 18215


if item.itemid == lotteryid then

if rand == 0 then

doCreatureSay(cid, "You have a Berserk Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7439,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 1 then

doCreatureSay(cid, "You have a Blue Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2158,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 2 then

doCreatureSay(cid, "You have a Bullseye Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7443,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 3 then

doCreatureSay(cid, "You have a Crystal Coin!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2160,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 4 then

doCreatureSay(cid, "You have a 15 Crystalline Arrows!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18304,15)

doRemoveItem(cid, item.uid, 1)

elseif rand == 5 then

doCreatureSay(cid, "You have a 15 Envenomed Arrows!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18437,15)

doRemoveItem(cid, item.uid, 1)

elseif rand == 6 then

doCreatureSay(cid, "You have a Gnomish Voucher Type CA2!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18522,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 7 then

doCreatureSay(cid, "You have a Gnomish Voucher Type MA2!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18519,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 8 then

doCreatureSay(cid, "You have a Great Health Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7591,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 9 then

doCreatureSay(cid, "You have a Great Mana Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7590,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 10 then

doCreatureSay(cid, "You have a Green Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2155,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 11 then

doCreatureSay(cid, "You have a 4 Health Potions!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7618,4)

doRemoveItem(cid, item.uid, 1)

elseif rand == 12 then

doCreatureSay(cid, "You have a 4 Mana Potions!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7620,4)

doRemoveItem(cid, item.uid, 1)

elseif rand == 13 then

doCreatureSay(cid, "You have a Mastermind Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7440,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 14 then

doCreatureSay(cid, "You have a Mushroom Pie!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18397,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 15 then

doCreatureSay(cid, "You have a Pet Pig!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18456,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 16 then

doCreatureSay(cid, "You have a 5 Platinum Coin!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2152,5)

doRemoveItem(cid, item.uid, 1)

elseif rand == 17 then

doCreatureSay(cid, "You have a Red Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2156,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 18 then

doCreatureSay(cid, "You have a Red Piece of Cloth!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 5911,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 19 then

doCreatureSay(cid, "You have a Red Teleport Crystal!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18509,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 20 then

doCreatureSay(cid, "You have a 2 Strong Health Potions!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7588,2)

doRemoveItem(cid, item.uid, 1)

elseif rand == 21 then

doCreatureSay(cid, "You have a 2 Strong Mana Potions!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7589,2)

doRemoveItem(cid, item.uid, 1)

elseif rand == 22 then

doCreatureSay(cid, "You have a Teleport Crystal!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18457,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 23 then

doCreatureSay(cid, "You have a 20 White Mushrooms!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2787,20)

doRemoveItem(cid, item.uid, 1)

elseif rand == 24 then

doCreatureSay(cid, "You have a Yellow Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2154,1)

doRemoveItem(cid, item.uid, 1)

	end

end

return TRUE

end
Explicações: local rand = math.random(0, 24) -> Ao clicar no item, é bem parecido com loteria. Você chuta um número, de 0 a 24 e reza pra cair o número escolhido. local lotteryid = 18215 -> id do item para clicar.
function onUse(cid, item, fromPosition, itemEx, toPosition)


local rand = math.random(0, 40)

local lotteryid = 18215


if item.itemid == lotteryid then

if rand == 0 then

doCreatureSay(cid, "You have a Berserk Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7439,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 1 then

doCreatureSay(cid, "You have a Blue Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2158,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 2 then

doCreatureSay(cid, "You have a Bullseye Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7443,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 3 then

doCreatureSay(cid, "You have a Crystal Coin!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2160,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 4 then

doCreatureSay(cid, "You have a 15 Crystalline Arrows!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18304,15)

doRemoveItem(cid, item.uid, 1)

elseif rand == 5 then

doCreatureSay(cid, "You have a 15 Envenomed Arrows!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18437,15)

doRemoveItem(cid, item.uid, 1)

elseif rand == 6 then

doCreatureSay(cid, "You have a Gnomish Voucher Type CA2!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18522,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 7 then

doCreatureSay(cid, "You have a Gnomish Voucher Type MA2!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18519,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 8 then

doCreatureSay(cid, "You have a Great Health Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7591,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 9 then

doCreatureSay(cid, "You have a Great Mana Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7590,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 10 then

doCreatureSay(cid, "You have a Green Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2155,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 11 then

doCreatureSay(cid, "You have a 4 Health Potions!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7618,4)

doRemoveItem(cid, item.uid, 1)

elseif rand == 12 then

doCreatureSay(cid, "You have a 4 Mana Potions!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7620,4)

doRemoveItem(cid, item.uid, 1)

elseif rand == 13 then

doCreatureSay(cid, "You have a Mastermind Potion!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7440,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 14 then

doCreatureSay(cid, "You have a Mushroom Pie!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18397,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 15 then

doCreatureSay(cid, "You have a Pet Pig!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18456,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 16 then

doCreatureSay(cid, "You have a 5 Platinum Coin!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2152,5)

doRemoveItem(cid, item.uid, 1)

elseif rand == 17 then

doCreatureSay(cid, "You have a Red Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2156,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 18 then

doCreatureSay(cid, "You have a Red Piece of Cloth!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 5911,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 19 then

doCreatureSay(cid, "You have a Red Teleport Crystal!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18509,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 20 then

doCreatureSay(cid, "You have a 2 Strong Health Potions!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7588,2)

doRemoveItem(cid, item.uid, 1)

elseif rand == 21 then

doCreatureSay(cid, "You have a 2 Strong Mana Potions!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 7589,2)

doRemoveItem(cid, item.uid, 1)

elseif rand == 22 then

doCreatureSay(cid, "You have a Teleport Crystal!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 18457,1)

doRemoveItem(cid, item.uid, 1)

elseif rand == 23 then

doCreatureSay(cid, "You have a 20 White Mushrooms!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2787,20)

doRemoveItem(cid, item.uid, 1)

elseif rand == 24 then

doCreatureSay(cid, "You have a Yellow Gem!", TALKTYPE_ORANGE_1)

	 doPlayerAddItem(cid, 2154,1)

doRemoveItem(cid, item.uid, 1)

elseif rand > 25 then

doCreatureSay(cid, "it broke!", TALKTYPE_ORANGE_1)

doRemoveItem(cid, item.uid, 1)

	end

end

return TRUE

end

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo