Ir para conteúdo

Featured Replies

Postado
1 minuto atrás, dissolima disse:

não está. já até tentei criar um arquivo de texto com o nome de meu ADM e joguei la dentro más msm assim os comandos usados não aparecem dentro do bloco de notas :/

Então você terá de adicionar uma função em todos os seus scripts.

Em cada script de talkaction que queira registrar o uso, adicione isso:
 

local file = io.open('data/logs/logs.txt','a')
                file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. getPlayerNameByGUID(cid) .." usou o comando ".. words .."\n")
                file:close()

Essa é a forma que conheço, porém será criado apenas um arquivo, onde ficará o log de todos os players.

Te ajudei? Clique em  Gostei ! 

²²²d¬¬b²²²

 

 

"She's got a smile that it seems to me...."  ♪♪

  • Respostas 15
  • Visualizações 1.5k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • O correto seria você ter criado um novo tópico fazendo seu pedido, mas vamos lá. Tente assim:   function onSay(cid, words, param, channel) local pname = getPlayerNameByGUID(getPlayerGUID(cid)

  • Sim!

Posted Images

Postado
  • Autor
11 minutos atrás, luangop disse:

Então você terá de adicionar uma função em todos os seus scripts.

Em cada script de talkaction que queira registrar o uso, adicione isso:
 


local file = io.open('data/logs/logs.txt','a')
                file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. getPlayerNameByGUID(cid) .." usou o comando ".. words .."\n")
                file:close()

Essa é a forma que conheço, porém será criado apenas um arquivo, onde ficará o log de todos os players.

poderia me explicar onde eu coloco essa função sem bugar o script ? coloqeui aqui mas parou de funcionar. mandarei o Script de createitem.lua

 

Spoiler

function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end

    local t = string.explode(param, ",")
    local ret = RETURNVALUE_NOERROR
    local pos = getCreaturePosition(cid)

    local id = tonumber(t[1])
    if(not id) then
        id = getItemIdByName(t[1], false)
        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
            return true
        end
    end

    local amount = 100
    if(t[2]) then
        amount = t[2]
    end

    local item = doCreateItemEx(id, amount)
    if(t[3] and getBooleanFromString(t[3])) then
        if(t[4] and getBooleanFromString(t[4])) then
            pos = getCreatureLookPosition(cid)
        end

        ret = doTileAddItemEx(pos, item)
    else
        ret = doPlayerAddItemEx(cid, item, true)
    end

    if(ret ~= RETURNVALUE_NOERROR) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
        return true
    end

    doDecayItem(item)
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(pos, 87)
    end

    return true
end

 

Postado
function onSay(cid, words, param, channel)
  local file = io.open('data/logs/logs.txt','a')
                file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. getPlayerNameByGUID(cid) .." usou o comando ".. words .."\n")
                file:close()
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end
    local t = string.explode(param, ",")
    local ret = RETURNVALUE_NOERROR
    local pos = getCreaturePosition(cid)
    local id = tonumber(t[1])
    if(not id) then
        id = getItemIdByName(t[1], false)
        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
            return true
        end
    end
    local amount = 100
    if(t[2]) then
        amount = t[2]
    end
    local item = doCreateItemEx(id, amount)
    if(t[3] and getBooleanFromString(t[3])) then
        if(t[4] and getBooleanFromString(t[4])) then
            pos = getCreatureLookPosition(cid)
        end
        ret = doTileAddItemEx(pos, item)
    else
        ret = doPlayerAddItemEx(cid, item, true)
    end
    if(ret ~= RETURNVALUE_NOERROR) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
        return true
    end
    doDecayItem(item)
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(pos, 87)
    end
    return true
end

Logo após o function onSay

Te ajudei? Clique em  Gostei ! 

²²²d¬¬b²²²

 

 

"She's got a smile that it seems to me...."  ♪♪

Postado
  • Autor
4 minutos atrás, luangop disse:

function onSay(cid, words, param, channel)
  local file = io.open('data/logs/logs.txt','a')
                file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. getPlayerNameByGUID(cid) .." usou o comando ".. words .."\n")
                file:close()
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end
    local t = string.explode(param, ",")
    local ret = RETURNVALUE_NOERROR
    local pos = getCreaturePosition(cid)
    local id = tonumber(t[1])
    if(not id) then
        id = getItemIdByName(t[1], false)
        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
            return true
        end
    end
    local amount = 100
    if(t[2]) then
        amount = t[2]
    end
    local item = doCreateItemEx(id, amount)
    if(t[3] and getBooleanFromString(t[3])) then
        if(t[4] and getBooleanFromString(t[4])) then
            pos = getCreatureLookPosition(cid)
        end
        ret = doTileAddItemEx(pos, item)
    else
        ret = doPlayerAddItemEx(cid, item, true)
    end
    if(ret ~= RETURNVALUE_NOERROR) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
        return true
    end
    doDecayItem(item)
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(pos, 87)
    end
    return true
end

Logo após o function onSay

deu esse erro na distro

Sem título.png

Postado
1 hora atrás, dissolima disse:

deu esse erro na distro

Sem título.png

function onSay(cid, words, param, channel)
  local file = io.open('data/logs/logs.txt','a')
                file:write("Dia: "..os.date("%d").."/"..os.date("%m").."/"..os.date("%Y").." Hora: "..os.date("%X").." :::: ".. getPlayerNameByGUID(getPlayerGUID(cid)) .." usou o comando ".. words .."\n")
                file:close()
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end
    local t = string.explode(param, ",")
    local ret = RETURNVALUE_NOERROR
    local pos = getCreaturePosition(cid)
    local id = tonumber(t[1])
    if(not id) then
        id = getItemIdByName(t[1], false)
        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
            return true
        end
    end
    local amount = 100
    if(t[2]) then
        amount = t[2]
    end
    local item = doCreateItemEx(id, amount)
    if(t[3] and getBooleanFromString(t[3])) then
        if(t[4] and getBooleanFromString(t[4])) then
            pos = getCreatureLookPosition(cid)
        end
        ret = doTileAddItemEx(pos, item)
    else
        ret = doPlayerAddItemEx(cid, item, true)
    end
    if(ret ~= RETURNVALUE_NOERROR) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
        return true
    end
    doDecayItem(item)
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(pos, 87)
    end
    return true
end

 

 

 

 

Nós somos aquilo que fazemos repetidamente. Excelência, não é um modo de agir, mas um hábito.

                                                                                                                                                                                                                                        Aristóteles 

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.7k

Informação Importante

Confirmação de Termo