Ir para conteúdo
  • 0

Script Cassino


Kluivert

Pergunta

Olá, estou com um problema no meu script de cassino, o player está conseguindo jogar sem ter dinheiro, será que alguém poderia me ajudar nisto?

 

 

Script

 

 

local bixos = {"Coelho", "Passaro", "Toto", "Viado", "Porco"}
local positions = {{x = 1308, y = 1347, z = 3}, {x = 1309, y = 1347, z = 3}, {x = 1310, y = 1347, z = 3}} -- Posicao q os bixos nascem
local price = 10000 -- Preco para jogar
local prize = 200000 -- 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(333334) > 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.")
    end
    
    setGlobalStorageValue(333334, os.time() + 8)
    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, 2500)
    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, 4500)
    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), "Você", 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), "Você", 93)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "Perdeu", 93)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "=(", 93)
        end
end, 6500)
    return true
end

 

 

Editado por Kluivert
Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

Tenta assim:

 

 

 

local bixos = {"Coelho", "Passaro", "Toto", "Viado", "Porco"}
local positions = {{x = 1308, y = 1347, z = 3}, {x = 1309, y = 1347, z = 3}, {x = 1310, y = 1347, z = 3}} -- Posicao q os bixos nascem
local price = 10000 -- Preco para jogar
local prize = 200000 -- 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(333334) > 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(333334, os.time() + 8)
    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, 2500)
    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, 4500)
    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), "Você", 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), "Você", 93)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "Perdeu", 93)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "=(", 93)
        end
end, 6500)
    return true
end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...