Postado Setembro 24, 2017 7 anos Opa, eu estou procurando por um script que funciona no dice, por exemplo, o jogador tira ao rolar o dado 3x uma sequencia de tres numeros (444) e ganha X item, porém só ganha uma vez, se tirar 444 novamente não irá ganhar nada. Queria isso pra todas as sequencias, 111, 222, 333, 444, 555 e 666. Editado Setembro 26, 2017 7 anos por dimmebag (veja o histórico de edições)
Postado Setembro 24, 2017 7 anos Solução Modifique seu dice.lua para esse: Spoiler local items = {[1] = {2160,1}, [2] = {2160,1}, [3] = {2160,3}, [4] = {2160,4}, [5] = {2160,5}, [6] = {2160,6}} -- edite o prêmio de acordo com o [número] = {id, quantidade} local repeated = 3 function onUse(cid, item, fromPosition, itemEx, toPosition) if(fromPosition.x ~= CONTAINER_POSITION) then doSendMagicEffect(fromPosition, CONST_ME_CRAPS) end local value = math.random(5792, 5797) doTransformItem(item.uid, value) local number = value - 5791 doCreatureSay(cid, getCreatureName(cid) .. ' rolled a ' .. number .. '.', TALKTYPE_ORANGE_1) if getPlayerStorageValue(cid, 65432) == -1 or getPlayerStorageValue(cid, 65432) > 10^(repeated-1) then setPlayerStorageValue(cid, 65432, "") end if getPlayerStorageValue(cid, 65431) == -1 then setPlayerStorageValue(cid, 65431, "") end setPlayerStorageValue(cid, 65432, getPlayerStorageValue(cid, 65432)..number) local sum = 0 for _ in string.gfind(getPlayerStorageValue(cid, 65432), number) do sum = sum + 1 end if sum == repeated then local sequences = getPlayerStorageValue(cid, 65431) local t = string.explode(sequences:gsub("'",""), ",") if not isInArray(t, number) then local p = getPlayerPosition(cid) doSendAnimatedText(p, "WINNER!", COLOR_ORANGE) doSendMagicEffect(p, CONST_ME_STUN) doPlayerAddItem(cid, items[number][1], items[number][2]) setPlayerStorageValue(cid, 65432, -1) local newnumber = sequences..","..number setPlayerStorageValue(cid, 65431, "'"..tostring(newnumber).."'") end end return true end Contato: Email: [email protected] Discord: Dwarfer#2715
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.