Eu fiz esse código a pedido do usuário @igorlabanca e tive ajuda do @zipter98 pra fazer.
Não vou explicar oq ele faz, vou somente postar o vídeo que o igor fez mostrando como funciona.
O código faz exatamente oq está no vídeo.
@EDIT algumas pessoas vieram até mim para dizer que estava dando para usar mesmo sem dinheiro. Esse problema já foi resolvido.
Crie Killua Cassino.lua em data/actions/scripts e coloque:
Se você usa a versão do 0.3 ou 0.4 do TFS, use assim:
local bixos = {"Dog", "Deer", "Pig", "Rat"} local positions = {{x = 133, y = 43, z = 7}, {x = 135, y = 43, z = 7}, {x = 137, y = 43, z = 7}} -- Posicao q os bixos nascem local price = 5000 -- Preco para jogar local prize = 50000 -- Premio function onUse(cid, item, fromPosition, itemEx, toPosition) local first = math.random(1, #bixos) local second = math.random(1, #bixos) local third = math.random(1, #bixos) local tab = {} if getGlobalStorageValue(82192) > os.time() then doPlayerSendCancel(cid, "Aguarde um pouco para apostar.") return true end if getPlayerMoney(cid) < price then doPlayerSendCancel(cid, "Voce precisa de " .. price .. " para jogar.") return true end setGlobalStorageValue(82192, os.time() + 6) for i = 1, (#positions) do doSendMagicEffect(positions[i], 22) end doPlayerRemoveMoney(cid, price) doCreateMonster(bixos[first], positions[1]) doSendMagicEffect(positions[1], 26) addEvent(doSendMagicEffect, 100, positions[1], 31) table.insert(tab, first) setGlobalStorageValue(bixos[first], getGlobalStorageValue(bixos[first])+1) addEvent(function() doCreateMonster(bixos[second], positions[2]) doSendMagicEffect(positions[2], 26) addEvent(doSendMagicEffect, 100, positions[2], 31) table.insert(tab, second) end, 1000) addEvent(function() doCreateMonster(bixos[third], positions[3]) doSendMagicEffect(positions[3], 26) addEvent(doSendMagicEffect, 100, positions[3], 31) setGlobalStorageValue(bixos[third], getGlobalStorageValue(bixos[third])+1) table.insert(tab, third) end, 2000) addEvent(function() doRemoveCreature(getTopCreature(positions[1]).uid) doRemoveCreature(getTopCreature(positions[2]).uid) doRemoveCreature(getTopCreature(positions[3]).uid) doSendMagicEffect(positions[1], 54) doSendMagicEffect(positions[2], 54) doSendMagicEffect(positions[3], 54) if tab[1] == tab[2] and tab[1] == tab[3] then doPlayerAddMoney(cid, prize) doSendAnimatedText(getThingPos(cid), "Voce", 93) addEvent(doSendAnimatedText, 800, getThingPos(cid), "Ganhou", 93) addEvent(doSendAnimatedText, 1600, getThingPos(cid), "" .. prize .."gps!", 93) doSendMagicEffect(getThingPos(cid), 30) doSendMagicEffect(positions[1], 30) doSendMagicEffect(positions[2], 30) doSendMagicEffect(positions[3], 30) addEvent(doSendMagicEffect, 800, getThingPos(cid), 29) addEvent(doSendMagicEffect, 800, positions[1], 29) addEvent(doSendMagicEffect, 800, positions[2], 29) addEvent(doSendMagicEffect, 800, positions[3], 29) addEvent(doSendMagicEffect, 1600, getThingPos(cid), 28) addEvent(doSendMagicEffect, 1600, positions[1], 28) addEvent(doSendMagicEffect, 1600, positions[2], 28) addEvent(doSendMagicEffect, 1600, positions[3], 28) else doSendAnimatedText(getThingPos(cid), "Voce", 93) addEvent(doSendAnimatedText, 800, getThingPos(cid), "Perdeu", 93) addEvent(doSendAnimatedText, 1600, getThingPos(cid), "=(", 93) end end, 3500) return true end
Se você usa o TFS 1.0, use assim:
local bixos = {"Dog", "Deer", "Pig", "Rat"} local positions = {{x = 133, y = 43, z = 7}, {x = 135, y = 43, z = 7}, {x = 137, y = 43, z = 7}} -- Posicao q os bixos nascem local price = 5000 -- Preco para jogar local prize = 50000 -- Premio function onUse(cid, item, fromPosition, itemEx, toPosition) local first = math.random(1, #bixos) local second = math.random(1, #bixos) local third = math.random(1, #bixos) local tab = {} if getGlobalStorageValue(82192) > os.time() then doPlayerSendCancel(cid, "Aguarde um pouco para apostar.") return true end if getPlayerMoney(cid) < price then doPlayerSendCancel(cid, "Voce precisa de " .. price .. " para jogar.") return true end setGlobalStorageValue(82192, os.time() + 6) for i = 1, (#positions) do doSendMagicEffect(positions[i], 22) end doPlayerRemoveMoney(cid, price) doCreateMonster(bixos[first], positions[1]) doSendMagicEffect(positions[1], 26) addEvent(doSendMagicEffect, 100, positions[1], 31) table.insert(tab, first) setGlobalStorageValue(bixos[first], getGlobalStorageValue(bixos[first])+1) addEvent(function() doCreateMonster(bixos[second], positions[2]) doSendMagicEffect(positions[2], 26) addEvent(doSendMagicEffect, 100, positions[2], 31) table.insert(tab, second) end, 1000) addEvent(function() doCreateMonster(bixos[third], positions[3]) doSendMagicEffect(positions[3], 26) addEvent(doSendMagicEffect, 100, positions[3], 31) setGlobalStorageValue(bixos[third], getGlobalStorageValue(bixos[third])+1) table.insert(tab, third) end, 2000) addEvent(function() doRemoveCreature(getTopCreature(positions[1]).uid) doRemoveCreature(getTopCreature(positions[2]).uid) doRemoveCreature(getTopCreature(positions[3]).uid) doSendMagicEffect(positions[1], 54) doSendMagicEffect(positions[2], 54) doSendMagicEffect(positions[3], 54) if tab[1] == tab[2] and tab[1] == tab[3] then doPlayerAddMoney(cid, prize) doCreatureSay(cid, "Voce", TALKTYPE_ORANGE_1) addEvent(doCreatureSay, 800, cid, "Ganhou", TALKTYPE_ORANGE_1) addEvent(doCreatureSay, 1600, cid, "" .. prize .."gps!", TALKTYPE_ORANGE_1) doSendMagicEffect(getThingPos(cid), 30) doSendMagicEffect(positions[1], 30) doSendMagicEffect(positions[2], 30) doSendMagicEffect(positions[3], 30) addEvent(doSendMagicEffect, 800, getThingPos(cid), 29) addEvent(doSendMagicEffect, 800, positions[1], 29) addEvent(doSendMagicEffect, 800, positions[2], 29) addEvent(doSendMagicEffect, 800, positions[3], 29) addEvent(doSendMagicEffect, 1600, getThingPos(cid), 28) addEvent(doSendMagicEffect, 1600, positions[1], 28) addEvent(doSendMagicEffect, 1600, positions[2], 28) addEvent(doSendMagicEffect, 1600, positions[3], 28) else doCreatureSay(cid, "Voce", TALKTYPE_ORANGE_1) addEvent(doCreatureSay, 800, cid, "Perdeu", TALKTYPE_ORANGE_1) addEvent(doCreatureSay, 1600, cid, "=(", TALKTYPE_ORANGE_1) end end, 3500) return true end
E coloque essa tag no actions.xml
<action actionid="2142" script="Killua Cassino.lua"/>
Daí basta colocar actionID 2141 na alavanca e pronto =)
Espero que gostem.