Jump to content

I would like a chat script


emuk

Recommended Posts

I think so. Try using SQL or Mysql.

Not needed. Do something like This:

  
local mesg = ""  
addCommandHandler("say", 
function (thePlayer,_,msg)  
local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
  
mesg = mesg.." [:"..hours..":"..minutes.."] "..getPlayerName ( thePlayer )..": "..msg 
end 
) 
  
function LogTimer () 
File = fileOpen ("logs.txt") 
if File then 
fileWrite (File, mesg ) 
else 
fileCreate ("logs.txt") 
File = fileOpen ("logs.txt")  
fileWrite (File, mesg ) 
end 
fileClose (File)  
mesg = "" 
end 
setTimer (LogTimer, 300000, 0 ) -- updating log file in every 1 hour  

I wrote this from mobile so couldn't test it but anyways this is just an example. ⌒.⌒

Edited by Guest
Link to comment
I think so. Try using SQL or Mysql.

Not needed. Do something like This:

  
local mesg = ""  
addCommandHandler("say", 
function (player,_,msg)  
local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
  
mesg = mesg.." [:"..hours..":"..minutes.."]"..msg 
end 
) 
  
function LogTimer () 
File = fileOpen ("logs.txt") 
if File then 
fileWrite (File, mesg ) 
else 
fileCreate ("logs.txt") 
File = fileOpen ("logs.txt")  
fileWrite (File, mesg ) 
end 
fileClose (File)  
end 
setTimer (LogTimer, 300000, 0 ) -- updating log file in every 1 hour  

I wrote this from mobile so couldn't test it but anyways this Just an example. ⌒.⌒

I had thought of something like that but my mta server does not allow direct link then I do not know how to read the file from website which is located on a different server

Link to comment
I think so. Try using SQL or Mysql.

Not needed. Do something like This:

  
local mesg = ""  
addCommandHandler("say", 
function (player,_,msg)  
local time = getRealTime() 
    local hours = time.hour 
    local minutes = time.minute 
  
mesg = mesg.." [:"..hours..":"..minutes.."]"..msg 
end 
) 
  
function LogTimer () 
File = fileOpen ("logs.txt") 
if File then 
fileWrite (File, mesg ) 
else 
fileCreate ("logs.txt") 
File = fileOpen ("logs.txt")  
fileWrite (File, mesg ) 
end 
fileClose (File)  
end 
setTimer (LogTimer, 300000, 0 ) -- updating log file in every 1 hour  

I wrote this from mobile so couldn't test it but anyways this Just an example. ⌒.⌒

I had thought of something like that but my mta server does not allow direct link then I do not know how to read the file from website which is located on a different server

My script is saving the logs in your resources folder. Its not sending any data to any website. Its keeps updating the log file after every one hour by a timer anyways I added another line to clear the data in memory when the data is saved in log file.

You can access that file by MTA > Mods > Deathmatch > resources > logs

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