• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua casino time

xakalrox19

New Member
Joined
Dec 2, 2015
Messages
3
Reaction score
0
had a casino system in my ot server however at the time I had a TSF 0.3.6 ... however now upgraded to 0.4 , however the time some script is very fast , I wonder where edict to leave the Random slower




Code:
local bixos = {"Pig", "Rat"}
local positions = {{x = 1598, y = 365, z = 4}, {x = 1599, y = 365, z = 4}, {x = 1600, y = 365, z = 4}} -- 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
 
Back
Top