• 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/roulette 0.3.6/0.4

Shiru Dev

New Member
Joined
Sep 2, 2022
Messages
17
Solutions
1
Reaction score
2
Hi,
Does any1 have script for roulette/casino for tfs 0.3.6//0.4?

Like; 1691028834837.png
If player have item XXX and press lever, items goes >>>, and then u get item from the middle.
 
Solution
Lua:
local config = {
    effect = 1345, -- effect on player
    effectReward = 322, --- effect on top of premium
    effectLever = 320, -- effect on top of lever
    eventCoin = 2159, -- item to play
    qtdCoin = 5, --amount of coin to play
    lose = false, --chaance for win NOTHING XD
    itemLose = 2638, -- item that represent the loss ( u need to aadd this item to the table)
    effectLose = 29, -- effect on top of prize when lose
    exaust = 10.0, -- exhaus
    storage = 23111, -- storaage exhaust
    used = 10, -- tempo = duraation time
    used_storage = 23112, -- Storage pra verificar se a roleta esta sendo usada
    used = 10,
    poss = {
        [1] = {x = 2484, y = 2439, z = 7},
        [2] = {x = 2485, y = 2439, z = 7}...
Does this roulette system exist for TFS 0.4 yes. once I downloaded from another forum, it's a Baiak server and I tested roulette; I really liked. If you want, you can check it out here. You can take the opportunity to get the system and put it on your server.

The roulette is the same as in the photo there

Where is the script? It is in actions/scripts/legendary_lever.lua and also in libs/legendary_lever.lua
 
Last edited:
Lua:
local config = {
    effect = 1345, -- effect on player
    effectReward = 322, --- effect on top of premium
    effectLever = 320, -- effect on top of lever
    eventCoin = 2159, -- item to play
    qtdCoin = 5, --amount of coin to play
    lose = false, --chaance for win NOTHING XD
    itemLose = 2638, -- item that represent the loss ( u need to aadd this item to the table)
    effectLose = 29, -- effect on top of prize when lose
    exaust = 10.0, -- exhaus
    storage = 23111, -- storaage exhaust
    used = 10, -- tempo = duraation time
    used_storage = 23112, -- Storage pra verificar se a roleta esta sendo usada
    used = 10,
    poss = {
        [1] = {x = 2484, y = 2439, z = 7},
        [2] = {x = 2485, y = 2439, z = 7},
        [3] = {x = 2486, y = 2439, z = 7},
        [4] = {x = 2487, y = 2439, z = 7},
        [5] = {x = 2488, y = 2439, z = 7}
    },
    items = { -- id = id do item - chance = chance de aparecer o item - count = a quantidade de item que a pessoa ira ganhar
        [1] = {id = 2506, chance = 20, count = 1},
        [2] = {id = 2480, chance = 30, count = 1},
        [3] = {id = 2128, chance = 60, count = 1},
        [4] = {id = 11562, chance = 70, count = 1},
        [5] = {id = 2160, chance = 65, count = 100},
        [6] = {id = 2173, chance = 50, count = 1},
        [7] = {id = 2415, chance = 35, count = 1},
      --  [8] = {id = 12386, chance = 50, count = 30},
      --  [9] = {id = 12391, chance = 45, count = 30},
      --  [10] = {id = 12390, chance = 40, count = 30},
        --[11] = {id = 12211, chance = 3, count = 1},
      --  [12] = {id = 12212, chance = 3, count = 1},
      --  [13] = {id = 12213, chance = 3, count = 1}
    }
}
 
local slot1, slot2, slot3, slot4, slot5
 
local function cleanTile(item, i)
    doCleanTile(config.poss[i], true)
    doCreateItem(item, 1, config.poss[i])
end
 
local function raffle(item)
    if slot4 ~= nil then
        slot5 = slot4
        cleanTile(1617, 5)
        doCreateItem(slot5.id, slot5.count, config.poss[5])
    end
    if slot3 ~= nil then
        slot4 = slot3
        cleanTile(1617, 4)
        doCreateItem(slot4.id, slot4.count, config.poss[4])
    end
    if slot2 ~= nil then
        slot3 = slot2
        cleanTile(1485, 3)
        doCreateItem(slot3.id, slot3.count, config.poss[3])
    end
    if slot1 ~= nil then
        slot2 = slot1
        cleanTile(1617, 2)
        doCreateItem(slot2.id, slot2.count, config.poss[2])
    end
    slot1 = {id = item.id, count = item.count}
    cleanTile(1617, 1)
    doCreateItem(slot1.id, slot1.count, config.poss[1])
end
 
local function result(uid)
    if isPlayer(uid) then
        if config.lose and slot3.id == config.itemLose then
            doSendMagicEffect(getCreaturePosition(uid), CONST_ME_POFF)
            doSendMagicEffect(config.poss[3], config.effectLose)
            doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_BLUE,
                                    "[ROLETA] Que azar, tente novamente!.")
        else
            doSendMagicEffect(getCreaturePosition(uid), config.effect)
            doSendMagicEffect(config.poss[3], config.effectReward)
            doPlayerSendTextMessage(uid, MESSAGE_STATUS_CONSOLE_BLUE,
                                    "[ROLETA] Voce ganhou " .. slot3.count .. " " .. getItemNameById(slot3.id) .. ". Parabens!")
            doPlayerAddItem(uid, slot3.id, slot3.count)
        end
    end
end
 
function onUse(cid, item, pos, itemEx, posEx)
    if item.itemid == 1945 then doTransformItem(item.uid, item.itemid + 1) end
    if item.itemid == 1946 then doTransformItem(item.uid, item.itemid - 1) end
 
    if getGlobalStorageValue(config.used_storage) <= os.time() then
        if not exhaustion.check(cid, config.storage) then
            if getPlayerItemCount(cid, config.eventCoin) >= config.qtdCoin then
                local rand = math.random(10, 30)
                doSendMagicEffect(pos, config.effectLever)
                setGlobalStorageValue(config.used_storage, rand + 5 + os.time())
                exhaustion.set(cid, config.storage, rand)
                doPlayerRemoveItem(cid, config.eventCoin, config.qtdCoin)
                local loop = 0
                slot1 = nil
                slot2 = nil
                slot3 = nil
                slot4 = nil
                slot5 = nil
 
                for i = 1, #config.poss do
                    if i == 3 then
                        cleanTile(1485, i)
                    else
                        cleanTile(1617, i)
                    end
                end
 
                while rand >= loop do
                    local roll = math.random(1, 100)
                    index = math.random(#config.items)
                    if roll <= config.items[index].chance then
                        local item = config.items[index]
                        loop = loop + 1
                        addEvent(raffle, loop * 1000, item)
                    end
                end
                addEvent(result, (rand + 2) * 1000, cid)
            else
                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,
                                        "[ROLETA] Voce precisa ter " .. config.qtdCoin .. " " .. getItemNameById(config.eventCoin) .. " na BP!.")
            end
        else
            doSendMagicEffect(fromPosition, CONST_ME_POFF)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,
                                    "Exhaustion, aguarde " .. exhaustion.get(cid, config.storage) .. " segundos para usar a roleta novamente!")
            return false
        end
        return true
    else
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[ROLETA] Sorteio em andamento, espere finalizar para iniciar outro.")
    end
end
Then; <action actionid="44950" event="script" value="roulette.lua"/> (remember to add action id to lever)
gl
Post automatically merged:

I almost forget, if u want to speed up this casino u need to edit this part
Lua:
  while rand >= loop do
                    local roll = math.random(1, 100)
                    index = math.random(#config.items)
                    if roll <= config.items[index].chance then
                        local item = config.items[index]
                        loop = loop + 1
                        addEvent(raffle, loop * 500, item)
                    end
                end
                addEvent(result, (rand + 2) * 500, cid)
            else

U can change from 1k to 500 etc
 
Last edited:
Solution
Back
Top