larissaots 163 Postado Maio 31, 2015 Share Postado Maio 31, 2015 Créditos à Caronte & Adriano SwaTT. Testado em TFS 0.4. Coloquei em spoiler porque o conteúdo é grande. VERSÃO 1 Observações PS: Lembrando, que para apostar, é só colocar grana no slot que se coloca arrows... e a quantidade de crystal coins é configurável, no início do script, alterando lá, já vai alterar a fala, que falará sempre a quantidade configurada.Detalhe: Quem quer que o local/item de aposta seja fixo, mude a TAG que coloca em actions.xml, só mude o ID do item. Como funciona O cassino se resume à 50% de chance de acertar ou errar. 50% Acertou? Ótimo, a sua grana dobra. 50% Errou? Ótimo, ele pega toda sua grana apostada.Prévia Caso não tenha dinheiro no slot de munições:Caso tenha dinheiro no slot de munições, mas não o suficiente:Caso ganhe:Caso perca:TutorialVá em actions/scripts/other e crie um arquivo piggybank.lua. "VALE LEMBRAR, ESSE PIGGY BANK JÁ EXISTE NO TIBIA, MAS DESEMPENHANDO OUTRA FUNÇÃO, ENTÃO É MELHOR CRIAR OUTRO ARQUIVO OU SÓ SUBSTITUIR." local qtdd = 10 -- quantidade minima para jogar local lost, winner = CONST_ANI_SUDDENDEATH, CONST_ANI_HOLY -- Efeitos: Ao perder, Ao ganhar function onUse(cid, item, frompos, item2, topos) local chance = math.random(0,100) local pos = getPlayerPosition(cid) local pos_ef = { {x= pos.x-1,y= pos.y-1,z= pos.z}, {x= pos.x,y= pos.y-1,z= pos.z}, {x= pos.x+1,y= pos.y-1,z= pos.z}, {x= pos.x+1,y= pos.y,z= pos.z}, {x= pos.x+1,y= pos.y+1,z= pos.z}, {x= pos.x,y= pos.y+1,z= pos.z}, {x= pos.x-1,y= pos.y+1,z= pos.z}, {x= pos.x-1,y= pos.y,z= pos.z} } --Verificar se tem crystals no slot -- if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid ~= 2160 then doCreatureSay(cid, 'You need crystal coins in your ammunition slot to play ! ', TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) --Verificar quantidade de cystals no ammo slot elseif getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_AMMO).type < qtdd then doCreatureSay(cid, "You don't have "..qtdd.." crystal coins in the arrows slot to play", TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) end if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 2160 and getPlayerSlotItem(cid, CONST_SLOT_AMMO).type >= qtdd then doCreatureSay(cid, "Let's see your lucky", TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_CRAPS) if chance <= 50 then -- GANHOU doPlayerAddItem(cid,2160,getPlayerSlotItem(cid, CONST_SLOT_AMMO).type) for i = 1, 8 do doSendDistanceShoot(pos_ef[i], pos, winner) end -- FECHA FOR elseif chance >= 50 then -- PERDEU doPlayerRemoveItem(cid,2160,getPlayerSlotItem(cid, CONST_SLOT_AMMO).type) doSendMagicEffect(pos, CONST_ME_BLOCKHIT) for i = 1, 8 do doSendDistanceShoot(pos_ef[i], pos, lost) end -- FECHA FOR end -- FECHA IF (CHANCE) end -- FECHA IF QUANTIDADE return true end Adicione em actions.xml: <action itemid="2114" event="script" value="other/piggybank.lua"/> VERSÃO 2 Observações Quantidade mínima de crystal coins para apostar/quebrar o piggy bank. local coins = 5 Chance do piggy bank quebrar, de 0 a 100, recomendo que não mude de 0 caso mude o item (piggy bank). local chancedequebrar = 0 Como funciona O player tem que adicionar um tributo de 5 crystal coins (configurável) ao piggy bank, sendo assim, terá de sortear: o dinheiro é descontado de qualquer parte do inventário do player. São 3 possibilidades que o player pode se deparar, são elas: Gold coinonde o player ganha a quantidade de 1 a 100 gold coins.Platinum coinonde o player ganha a quantidade de 1 a 15 platinum coins.Crystal coinonde o player ganha a quantidade de 1 a 70 crystal coins. Prévia Caso não tenha dinheiro na Bag:Caso caia em gold: Caso caia em platinum:Caso caia em crystal:TutorialVá em actions/scripts/other e crie um arquivo piggybank.lua. function onUse(cid, item, frompos, item2, topos) rand1 = math.random(1,100) rand2 = math.random(1,70) rand3 = math.random(1,15) local coins = 5 -- Quantide de crystal coins que irá consumir local chancedequebrar = 0 -- porcentagem da chance de se quebrar, use 0 para não quebrar dinheiro = coins * 10000 if getPlayerMoney(cid) >= dinheiro then doPlayerRemoveMoney(cid, dinheiro) else doCreatureSay(cid, '~You need '..coins..' crystals to break it !!!~', TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return false end if rand1 <= 50 then doPlayerAddItem(cid,2148,rand1) doCreatureSay(cid, '~Holy Shit !!! only '..rand1..' golds, my mom will kill me~', TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW) end if rand1 >= 51 and rand1 <= 70 then doPlayerAddItem(cid,2152,rand3) doCreatureSay(cid, '~Oh-oh '..rand3..' Platinum coins!, would i try again ?~', TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_BLUE) end if rand1 >= 90 then doPlayerAddItem(cid,2160,rand2) doCreatureSay(cid, '~Oh My God! '..rand2..' Crystal coins !!!', TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_WATERSPLASH) end if rand1 <= chancedequebrar then doPlayerAddMoney(cid, dinheiro) doTransformItem(item.uid,item.itemid+1) end return 1 end Adicione em actions.xml: <action itemid="2114" event="script" value="other/piggybank.lua"/> Link para o comentário Compartilhar em outros sites More sharing options...
Caronte 444 Postado Outubro 6, 2016 Share Postado Outubro 6, 2016 Só eu achei esse script legal? Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados