[LUA 5]last seen logger
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

[LUA 5]last seen logger

Started by ruler, 12 June, 2005, 20:41:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ruler

howdy
i'm trying to create a "last seen" logger for Registered users.

the file that holds the info looke like this..

jed|06/12/05|18:58:27
john|06/12/05|15:40:11
joe|06/12/05|17:22:54

where its nick,date,time storred in a .dat or .txt file.
only when the user is registered the nick is added and when a registered user logs off it should edit the date and time of the logoff.
oh and also when shutting down the hubsoft the changes will need to be saved.
anyone know of a script like this please send me a link. many thanks

The Direct Connect Global Banlist get protected.

jiten

QuoteOriginally posted by ruler
howdy
i'm trying to create a "last seen" logger for Registered users.

the file that holds the info looke like this..

jed|06/12/05|18:58:27
john|06/12/05|15:40:11
joe|06/12/05|17:22:54

where its nick,date,time storred in a .dat or .txt file.
only when the user is registered the nick is added and when a registered user logs off it should edit the date and time of the logoff.
oh and also when shutting down the hubsoft the changes will need to be saved.
anyone know of a script like this please send me a link. many thanks
Search the forum for "Seen Bot".
With some minor changes it will fulfill your request.

Cheers

ruler

i didnt find anything like what i am looking for, most of the scripts i did see were massive. i'm sure it can be done with a smaller script.
thanks for the reply anyway

The Direct Connect Global Banlist get protected.

Dessamator

QuoteOriginally posted by ruler
i didnt find anything like what i am looking for, most of the scripts i did see were massive. i'm sure it can be done with a smaller script.
thanks for the reply anyway

well if u think it can be done with a smaller script do it urself, and plus, every script starts with a smaller version, find it !

Good luck
Ignorance is Bliss.

ruler

if i could do it myself i wouldnt have made a post here now would i?
if it were in the old LUA then it would have been simple as hell but i am not quiter familar with the way the new LUA works hence the reason for my request.
there isnt much explanation or examples on how to read/write/edit text files yet how ever i did see a nice little post from Plop which did help.
everything i have tried either gives me an error or wont work the way i expected but thanks for the reply anyhows

The Direct Connect Global Banlist get protected.

Dessamator

#5
well, u obviously dont know what ur talking about , in the how to section,

there is a detailed explanation on how to do all of that in lua 5 scripts,  if u havent found it than u obviously need to fine tune ur searching habilities

either way, try clicking here  

and for help on how to manipulate  files  search the howto sections !
Ignorance is Bliss.

ruler

thanks for that link and now for the last question  :D
i know the line...

f:write("blablabla") -- writes to file

but who can i remove or replace a line?
i am looking still in the forums but with no luck as yet!
thanks

The Direct Connect Global Banlist get protected.

Dessamator

replacing a line is easy, just use a loop and replace it,

if line =="blah" then -- line=nil line="blah2"

or use
string.gsub(line, "blah", "") or string.gsub(line,"blah", "blah2"


 same thing for removing a line !
Ignorance is Bliss.

ruler

no luck, it didnt remove the line  ?(
when i open the text file, the same line is still there and has not been removed or over written.
im not sure if i need to use...

local f = io.open(filename, "w")
local f = io.open(filename, "w+")
local f = io.open(filename, "a")
local f = io.open(filename, "a+")


the basic loop looks like this ...

   for line in io.lines("../scripts/RegUserLastSeen.txt") do

      s,e,nme,dat,tme=string.find(line,"(.+)%|(.+)%|(%d+)")
      if nick == nme then
-- user name matched in text file
-- delete this user/line from text file
-- replace with same nick but new date and time
      break end

   end

thats is kind of what i have so far and what i am trying to do followed by the --
hope it makes sence  8o

The Direct Connect Global Banlist get protected.

Dessamator

#9
ok lets try it another way,
1. put all the lines in a variable, excluding the lines u dont need, and with all the changes u require !
2.Erase the old file,
3.Create a new file
4.Write the changes to the new file !

P.S.: this is easier to do with tables, doing it like this isnt very efficient !
Ignorance is Bliss.

ruler

i thought about doing it with tables too but lots more work involved  :D
i was just looking for a simpler way of doing it but i am now beginning to think i might have to do it with tables after all  8o
thanks for the reply and the help, much appreciated

The Direct Connect Global Banlist get protected.

SMF spam blocked by CleanTalk