Jump to content

help


Ahmed Ly

Recommended Posts

if not fileExists( "texts/log.txt" ) then
    fileCreate( "texts/log.txt" ) 
end

addEventHandler("onPlayerChat",root,
    function (message)
        if message ~= "" or message ~= " " then
            local logs = fileOpen("texts/log.txt",false)
            local name = getPlayerName(source)
            local text = fileRead(logs, 1000000)
            local t = getRealTime()
            local d,m,y,h,m,s = t.monthday,t.month,t.year,t.hour,t.minute,t.second
            local timestamp = "["..d.."/"..m.."/"..string.sub(y,2).."-"..h..":"..m..":"..s.."]"
            local text = timestamp.." "..name..": "..message.."\n"
            fileWrite(logs,text)
            fileFlush(logs)
            fileClose(logs)
        end
    end
)

 

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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