emuk Posted March 6, 2014 Posted March 6, 2014 I would like to read the chat (or at least the last lines) of my server on my website in realtime, is this possibile to do ? thanks
Saml1er Posted March 6, 2014 Posted March 6, 2014 (edited) 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 March 6, 2014 by Guest
emuk Posted March 6, 2014 Author Posted March 6, 2014 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
Saml1er Posted March 6, 2014 Posted March 6, 2014 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
oPIXz Posted March 6, 2014 Posted March 6, 2014 https://community.multitheftauto.com/ind ... ils&id=487
emuk Posted March 6, 2014 Author Posted March 6, 2014 https://community.multitheftauto.com/index.php?p=resources&s=details&id=487 thanks this is interesting
Thorxx Posted March 6, 2014 Posted March 6, 2014 You can also use my resource: https://community.multitheftauto.com/ind ... ls&id=8824
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now