Jump to content

¿Como realizar un logs de una resources de chatprivado?


Recommended Posts

Hola mi pregunta es como puedo realizar un logs osea un historial de todo los mensajes que fueron enviado atravez de esa resources EJ

la resource chatpriva tiene la tecla F3 para abrir una ventana para poder enviar los mensajes.

Es Posible crear un logs para poder leer esos mensajes los administradores?

Link to comment
  • 2 weeks later...

esto sirve?

function sendChatMessage(ply) 
    outputDebugString("sendChatMessage: " .. tostring(ply)) 
    if chat[ply] and isElement(chat[ply].wnd) then 
        local newText = guiGetText(chat[ply].edit) 
        if newText and string.len(newText) > 0 then 
            local oldText = guiGetText(chat[ply].memo) 
            if not oldText then oldText = "" end 
            oldText = oldText .. getPlayerName(g_LocalPlayer) .. ": " .. newText .. "\n" 
            guiSetText(chat[ply].memo, oldText) 
            guiSetText(chat[ply].edit, "") 
            guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText)) 
  
            triggerServerEvent("onGUIPrivateMessage", g_LocalPlayer, ply,newText)  
        end  
    end 
end 
function recieveChatMessage(ply, msg) 
    outputDebugString("recieveChatMessage: " .. msg) 
    if not chat[ply] then 
        buildChatWindow(ply) 
    end 
     
    newmsg.show = true 
    newmsg.tick = getTickCount() 
     
    ---guiSetText(newmsg.lbl, getPlayerName(ply) .. ": " .. msg .. "\n") 
guiSetText(newmsg.lbl, "Tiene UN Mensage " .. getPlayerName(ply) .. "\n") 
    anims.nmfadein:play() 
    anims.nmtextin:play() 
    --anims.nmslidein:play() 
  
    local oldText = guiGetText(chat[ply].memo) 
    if not oldText then oldText = "" end 
    oldText = oldText .. getPlayerName(ply) .. ": " .. msg .. "\n" 
    guiSetText(chat[ply].memo, oldText) 
    guiMemoSetCaretIndex(chat[ply].memo, string.len(oldText)) 
end 

Link to comment

No, estas logueando un index segun leo del script.

Te dejo un ejemplo de un script que hice hace tiempo:

  
--[[ 
  
* zGx - Zone Gaming Community 2014 
* Programado por CiBeR 
* Todos los derechos reservados.  
* Prohibido su uso fuera del servidor Oficial zGx. 
  
Modulo: Server - Log Chat 
  
]]-- 
  
function log_chat(message, messageType) 
    local log = fileOpen("logs/log_chat.log") 
    local size = fileGetSize ( log ) 
    local place = fileSetPos(log,size) 
    local name = getPlayerName(source):gsub ( "#%x%x%x%x%x%x", "" ) 
    local clan = getPlayerTeam(source) 
    if clan then 
    local clanName = getTeamName(clan)or"Ninguno" 
    end 
    local fecha = getRealTime() 
    local an = fecha.year+1900 
    local mes = fecha.month+1 
    local fec = ""..string.format("%02d", fecha.monthday).."/"..string.format("%02d", mes).."/"..an.." "..string.format("%02d", fecha.hour)..":"..string.format("%02d", fecha.minute)..":"..string.format("%02d", fecha.second) 
        if messageType == 0 then 
        fileWrite(log, "["..fec.."][CHAT: "..name.." Dijo: "..message.." |CLAN: "..clanName.." ]\n")  
        fileClose(log) 
        elseif messageType == 2 then 
        fileWrite(log, "["..fec.."][TEAMCHAT: "..name.." Dijo: "..message.." |CLAN: "..clanName.." ]\n")  
        fileClose(log) 
        end 
end 
addEventHandler("onPlayerChat",root,log_chat) 

Para que funcione asi como esta, recorda que tenes que tener creado un archivo llamado log_chat.log dentro de la carpeta /logs/

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...