Ir para conteúdo

Featured Replies

Postado

Olá pessoal , estou com esse erro chatinho :C , esse arquivo é um "mod" com varias talk,action,etc. eu tentei usar no notice pelo talkaction , mas da um erro "enought memory" ai optei em usar o do mod e acontece isso quando usa o comando , fico grato desde ja 



[Error - TalkAction Interface]
                domodlib('news-config')

                local config = {
                        added = added,
                        cleaned = cleaned
                }

                function onSay(cid, words, param, channel)
                        if(not checkExhausted(cid, 666, 10)) then
                                return false
                        end

                        local t = string.explode(param, ",")
                        if(table.isStrIn(param, config.add)) then
                                if getPlayerGroupId (cid) > 3 then
                                        file = io.open('data/txt/notice.txt','a+')
                                        if(param == '') then
                                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                                                return true
                                        end

                                        notice = file:write("\n"..getPlayerName(cid).." at " .. os.date("%d %B %Y - %X ", os.time()) .."\n"..t[2].."\n")
                                        file:close()

                                        return true
                                end
                        elseif(table.isStrIn(param, config.clean)) then
                                if getPlayerGroupId (cid) > 3 then
                                        file = io.open('data/txt/notice.txt','w')
                                        if(param == '') then
                                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                                                return true
                                        end

                                        notice = file:write("Server News:\n")
                                        file:close()

                                        return true
                                end

                                return false
                        end

                        file = io.open('data/txt/notice.txt','r')
                        notice = file:read(-1)
                        doShowTextDialog(cid, 7528, notice)
                        file:close()

                        return true
                end
        :onSay
Description:
data/lib/012-table.lua:40: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
        [C]: in function 'pairs'
        data/lib/012-table.lua:40: in function 'isStrIn'
        [string "LuaInterface::loadBuffer"]:14: in function <[string "LuaInterface::loadBuffer"]:8>

[Error - TalkAction Interface]
                domodlib('news-config')

                local config = {
                        added = added,
                        cleaned = cleaned
                }

                function onSay(cid, words, param, channel)
                        if(not checkExhausted(cid, 666, 10)) then
                                return false
                        end

                        local t = string.explode(param, ",")
                        if(table.isStrIn(param, config.add)) then
                                if getPlayerGroupId (cid) > 3 then
                                        file = io.open('data/txt/notice.txt','a+')
                                        if(param == '') then
                                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                                                return true
                                        end

                                        notice = file:write("\n"..getPlayerName(cid).." at " .. os.date("%d %B %Y - %X ", os.time()) .."\n"..t[2].."\n")
                                        file:close()

                                        return true
                                end
                        elseif(table.isStrIn(param, config.clean)) then
                                if getPlayerGroupId (cid) > 3 then
                                        file = io.open('data/txt/notice.txt','w')
                                        if(param == '') then
                                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                                                return true
                                        end

                                        notice = file:write("Server News:\n")
                                        file:close()

                                        return true
                                end

                                return false
                        end

                        file = io.open('data/txt/notice.txt','r')
                        notice = file:read(-1)
                        doShowTextDialog(cid, 7528, notice)
                        file:close()

                        return true
                end
        :onSay
Description:
data/lib/012-table.lua:40: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
        [C]: in function 'pairs'
        data/lib/012-table.lua:40: in function 'isStrIn'
        [string "LuaInterface::loadBuffer"]:14: in function <[string "LuaInterface::loadBuffer"]:8>

Postado

A talkaction fica assim:

 

Spoiler

 domodlib('news-config')
                local config = {
                        add = "added",
                        clean = "cleaned"
                }
                function onSay(cid, words, param, channel)
                        if(not checkExhausted(cid, 666, 10)) then
                                return false
                        end
                        local t = string.explode(param, ",")
                        if(table.isStrIn(param, config.add)) then
                                if getPlayerGroupId (cid) > 3 then
                                        file = io.open('data/txt/notice.txt','a+')
                                        if(param == '') then
                                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                                                return true
                                        end
                                        notice = file:write("\n"..getPlayerName(cid).." at " .. os.date("%d %B %Y - %X ", os.time()) .."\n"..t[2].."\n")
                                        file:close()
                                        return true
                                end
                        elseif(table.isStrIn(param, config.clean)) then
                                if getPlayerGroupId (cid) > 3 then
                                        file = io.open('data/txt/notice.txt','w')
                                        if(param == '') then
                                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                                                return true
                                        end
                                        notice = file:write("Server News:\n")
                                        file:close()
                                        return true
                                end
                                return false
                        end
                        file = io.open('data/txt/notice.txt','r')
                        notice = file:read(-1)
                        doShowTextDialog(cid, 7528, notice)
                        file:close()
                        return true
                end

 

 

Contato:

 

Postado
  • Autor

erro.thumb.png.cfea5ed78dff6cbc10f9fa6077455bb9.png@Dwarfer irmão o erro persiste ainda x.x , nao sei mas oque fazer ahsuhsauuhshus

Description:
data/lib/012-table.lua:40: bad argument #1 to 'pairs' (table expected, got string)
stack traceback:
        [C]: in function 'pairs'
        data/lib/012-table.lua:40: in function 'isStrIn'
        [string "LuaInterface::loadBuffer"]:11: in function <[string "LuaInterface::loadBuffer"]:6>

pode ser alguma função faltando na lib talvez?.eu tentei usar um talkaction de "notice" diretamente , nos script de talk mas da um erro dizendo "enought memory"
estou usando otx server

up

Editado por Higuindt (veja o histórico de edições)

Postado

Acabou que nem tinha olhado direito e me passei em uma questão. Modifiquei também para ver se resolve o problema "not enough memory". 

 

Spoiler

domodlib('news-config')
local config = {
    add = {"added", "add"},
    clean = {"cleaned", "clean"}
}
function onSay(cid, words, param, channel)
    if(not checkExhausted(cid, 666, 10)) then
        return false
    end
    
    local t = string.explode(param, ",")
    
    if(table.isStrIn(param, config.add)) then
        if getPlayerGroupId (cid) > 3 then
            file = io.open('data/txt/notice.txt','a+')
            if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                return true
            end
            notice = file:write("\n"..getPlayerName(cid).." at " .. os.date("%d %B %Y - %X ", os.time()) .."\n"..t[2].."\n")
            file:close()
        return true
        end
    elseif(table.isStrIn(param, config.clean)) then
        if getPlayerGroupId (cid) > 3 then
            file = io.open('data/txt/notice.txt','w')
            if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
                return true
            end
            notice = file:write("Server News:\n")
            file:close()
            return true
        end
    return false
    end
    file = io.open('data/txt/notice.txt','r')
    notice = file:read("*a")
    doShowTextDialog(cid, 7528, notice)
    file:close()
    return true
end

 

 

Contato:

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo