• 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!

Get Messages from chat

leonardocy

Member
Joined
Feb 9, 2015
Messages
20
Reaction score
8
Location
Brazil
hello guys i'm working in a dice script to a server 8.6 but i'm have an issue, i dont have way to get messages from default chat can anybody help me in this code?
@gugu15 are the author.
i'm only triying to modify for a ot 8.6.
This code is for dice, im trying to transform to System Based.
Lua:
function diceSul()
diceSulth:setVisible(false)
if dicerScript == nil then
dicerScript = cycleEvent( function ()
    if g_game.isOnline() then
        local player = g_game.getLocalPlayer()
        local pos = player:getPosition()
        local clientTile = g_map.getTile({x = pos.x - 2, y = pos.y, z = pos.z})
        -- local diceTile = g_map.getTile({x = pos.x, y = pos.y +1, z = pos.z}):getTopThing()
        local tableTile = g_map.getTile({x = pos.x - 1, y = pos.y + 1, z = pos.z}):getTopThing()
        local tablePos = g_map.getTile({x = pos.x - 1, y = pos.y + 1, z = pos.z}):getPosition()
        local bp1 = {['x'] = 65535, ['y'] = 64, ['z'] = 0}
        local bp2 = {['x'] = 65535, ['y'] = 65, ['z'] = 0}
        local bp3 = {['x'] = 65535, ['y'] = 66, ['z'] = 0}
        local bp4 = {['x'] = 65535, ['y'] = 67, ['z'] = 0}
        local bp5 = {['x'] = 65535, ['y'] = 68, ['z'] = 0}
-- here is the problem
-- here is the problem
        local mensagem = modules.game_console.msgHistory() -- here is the problem
-- here is the problem
-- here is the problem
function diceTile()
            return math.random(6)
        end
        diceTile()
        --local diceLow = {5792, 5793, 5794} --[[1, 2, 3]]
        --local diceHight = {5795, 5796, 5797} --[[4, 5, 6]]
        if getMyMoney() < 100 or getMyMoney() > 2700 then
        scheduleEvent( function ()
            if getMyMoney() < 100 or getMyMoney() > 2700 then
                --g_game.move(diceTile, bp1, diceTile:getCount())
                g_game.talk("Preciso sair, desculpe :/")
                    scheduleEvent( function ()
                        if getMyMoney() < 100 or getMyMoney() > 2700 then
                            g_game.forceLogout()
                            --cancelDice()
                            removeEvent(rodadado)
                            rodadado = nil
                            removeEvent(verificaDado)
                            verificaDado = nil
                            removeEvent(horaDePagar)
                            horaDePagar = nil
                            cancelAntiLixo()
                            tirandoLixo = nil
                           
                        end
                end, 5000)
            end
            end, 3000)
        end
         
       
            if clientTile:getTopCreature() == nil then
                g_game.turn(North)
            elseif clientTile:getTopCreature() ~= nil then
                g_game.turn(West)
            end
       
            if clientTile:getTopCreature() ~= nil then
                local apostador = clientTile:getTopCreature()
                local apostadorName = apostador:getName()
                if tableTile:getId() == 3043 then
                local moneyOnTable = tableTile:getCount()
                    if tableTile:getCount() > 4 and tableTile:getCount() < 51 and mensagem == apostadorName..': l' then
                        if ((diceTile() ~= 0 and diceTile() ~= nil) and tableTile:getCount() > 4 and tableTile:getCount() < 51) then
                            aposta = moneyOnTable
                            antesMoney = getMyMoney()
                            g_game.move(tableTile, bp1, tableTile:getCount())
                    if rodadado == nil then
                        rodadado = cycleEvent( function()
                            diceTile()
                            depoisMoney = getMyMoney()
                            if verificaDado == nil and antesMoney < depoisMoney then
                                verificaDado = cycleEvent( function()
                                --local diceId = g_map.getTile({x = pos.x, y = pos.y +1, z = pos.z}):getTopThing():getId()
                                    if diceTile() == 1 or diceTile() == 2 or diceTile() == 3 then
                                        g_game.talk("Parabens, vc ganhou! Jogue Dnv!")
                                            if horaDePagar == nil then
                                            horaDePagar = cycleEvent(function ()
                                                pagamento = (math.floor((aposta*70)/100)+aposta)
                                                        if tableTile:getId() ~= '3043' then
                                                            if player:getItem(3043):getCount() >= pagamento*1 and antesMoney < depoisMoney then
                                                                g_game.move(player:getItem(3043),tablePos, pagamento)
                                                                depoisMoney = nil
                                                                antesMoney = nil
                                                                aposta = nil
                                                                    scheduleEvent( function()
                                                                        local head = InventorySlotHead
                                                                        local player = g_game.getLocalPlayer()
                                                                        local hat = player:getInventoryItem(head)
                                                                            g_game.use(hat)
                                                                    end, 500)
                                                            elseif player:getItem(3043):getCount() <= pagamento*1 and antesMoney < depoisMoney then
                                                                local diferenca = (player:getItem(3043):getCount() - pagamento)
                                                                g_game.move(player:getItem(3043),tablePos, player:getItem(3043):getCount())
                                                                scheduleEvent( function ()
                                                                    g_game.move(player:getItem(3043), tablePos, diferenca*-1)
                                                                    aposta = nil
                                                                    depoisMoney = nil
                                                                    antesMoney = nil
                                                                        scheduleEvent( function()
                                                                            local head = InventorySlotHead
                                                                            local player = g_game.getLocalPlayer()
                                                                            local hat = player:getInventoryItem(head)
                                                                                g_game.use(hat)
                                                                        end, 500)
                                                                    end, 500)
                                                            end
                                                        end
                                            removeEvent(horaDePagar)
                                            horaDePagar = nil
                                            end, 1000)
                                            end
                                    removeEvent(verificaDado)
                                    verificaDado = nil
                                    modules.game_console.limpaDefault()
                                    elseif diceTile() ~= 1 and diceTile() ~= 2 and diceTile() ~= 3 then
                                        g_game.talk("Voce perdeu :/, tente dnv!")
                                        removeEvent(verificaDado)
                                        verificaDado = nil
                                        modules.game_console.limpaDefault()
                                    end
                                end, 1000)
                            end
                            removeEvent(rodadado)
                            rodadado = nil
                        end, 2000)   
                        end
                        end
                    elseif tableTile:getCount() > 4 and tableTile:getCount() < 51 and mensagem == apostadorName..': h' then
                        if ((diceTile() ~= 0 and diceTile() ~= nil) and tableTile:getCount() > 4 and tableTile:getCount() < 51) then
                            aposta = moneyOnTable
                            antesMoney = getMyMoney()
                            g_game.move(tableTile, bp1, tableTile:getCount())
                        if rodadado == nil then
                        rodadado = cycleEvent( function()
                            diceTile()
                            depoisMoney = getMyMoney()
                                if verificaDado == nil and antesMoney < depoisMoney then
                                verificaDado = cycleEvent( function()
                                --local diceId = g_map.getTile({x = pos.x, y = pos.y +1, z = pos.z}):getTopThing():getId()
                                    if diceTile() == 4 or diceTile() == 5 or diceTile() == 6 then
                                        g_game.talk("Parabens, vc ganhou! Jogue Dnv!")
                                        if horaDePagar == nil then
                                            horaDePagar = cycleEvent(function ()
                                                pagamento = (math.floor((aposta*70)/100)+aposta)
                                                        if tableTile:getId() ~= '3043' then
                                                            if player:getItem(3043):getCount() >= pagamento*1 and antesMoney < depoisMoney then
                                                                g_game.move(player:getItem(3043),tablePos, pagamento)
                                                                depoisMoney = nil
                                                                antesMoney = nil
                                                                aposta = nil
                                                                    scheduleEvent( function()
                                                                        local head = InventorySlotHead
                                                                        local player = g_game.getLocalPlayer()
                                                                        local hat = player:getInventoryItem(head)   
                                                                            g_game.use(hat)
                                                                    end, 500)
                                                            elseif player:getItem(3043):getCount() <= pagamento*1 and antesMoney < depoisMoney then
                                                                local diferenca = (player:getItem(3043):getCount() - pagamento)
                                                                g_game.move(player:getItem(3043),tablePos, player:getItem(3043):getCount())
                                                                scheduleEvent( function ()
                                                                    g_game.move(player:getItem(3043), tablePos, diferenca*-1)
                                                                    aposta = nil
                                                                    depoisMoney = nil
                                                                    antesMoney = nil
                                                                        scheduleEvent( function()
                                                                            local head = InventorySlotHead
                                                                            local player = g_game.getLocalPlayer()
                                                                            local hat = player:getInventoryItem(head)
                                                                                g_game.use(hat)
                                                                        end, 500)
                                                                    end, 500)
                                                            end
                                                        end
                                            removeEvent(horaDePagar)
                                            horaDePagar = nil
                                            end, 400)
                                            end
                                     removeEvent(verificaDado)
                                     verificaDado = nil
                                     modules.game_console.limpaDefault()
                                    elseif diceTile() ~= 4 and diceTile() ~= 5 and diceTile() ~= 6  then
                                        g_game.talk("Voce perdeu :/, tente dnv!")
                                        removeEvent(verificaDado)
                                        verificaDado = nil
                                        modules.game_console.limpaDefault()
                                    end
                                end, 500)
                                end
                            removeEvent(rodadado)
                            rodadado = nil
                        end, 400)
                        end
                        end
                    end
                end
            end
        end
        --[[*]]
end, 2000)
end
 
Last edited:
idk if it is necessary but I think of something like "LocalSpeechProxy:OnReceive(callback)" of the xenobot to receive the messages here in the otclient do not misunderstand me I just gave an information of how I am imagining.
 
What a surprise!
Uses the onTalk function with the Connect function
 
Back
Top