User Login Log Help me...
 

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

User Login Log Help me...

Started by NightLitch, 13 November, 2003, 20:38:30

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NightLitch

Hey Guy''s!

I have a problem solving a problem am out of idees
or should I say don't know what/how to do the function...  :))

This Is what I have done

----------------------------
--[ User Logger Function ]--
----------------------------
function DoUserLogger(curUser,data)
	local nick = GetItemByName(curUser.sName)
	if USERLOGGER[strlower(nick)] == nil or USERLOGGER[strlower(nick)] == "" then
		SendToAll("NOT IN FILE, GETTING LOGGED")
		USERLOGGER[strlower(curUser.sName)] = "online"
	else
		if strlower(nick) == USERLOGGER[strlower(nick)] then
			SendToAll("LOGGED IN TABLE/FILE")
		end
	end
end

function LoggerControl(curUser,data)

	-- Here I want To check if users are online or not when restarting the hubsoft
	-- Cause the file won't get emty if restarting the hubsoft...
	-- How Would I Do This.... Help... Me...

	if GetItemByName(USERLOGGER) == 1 then

	-- something or not

	end
end

I want in Main() to check the file if user is logged in or not... or a better solusion how will I create a usefull
logger that will not emty the table if script being restarted..? (yes, log into a file BUT! how will the file get
erased if hub is shutdown or restarted??)

everyone understand my english... ?    ?(

Come With idees plz... or better solusions... :D

/NightLitch
//NL

pHaTTy

for erasing the file use a function like this

function OnExit()
openfile("Whereever/file.txt" "w")
Write(" ")
closefile()
end


sumit like that yep :)
Resistance is futile!

NightLitch

will that work???

have tried before...

but will try again... optimist as I am... heh

ThX

/NightLitch
//NL

NightLitch

How come when I use this function and stop the hub and start
it again the script's arent loaded????

something wrong in my function???


function OnExit()
   local f = openfile(LOGGERFILE, "w")
   write(f, " ")
   closefile(f)
end


/NightLitch
//NL

NightLitch

Ok got the funtion working


function OnExit()
   local f = openfile(LOGGERFILE, "w")
   if f == nil then
   else
   write(f, " ")
   closefile(f)
   end
end


But when starting the hub again the script are not loaded why???

/NightLitch
//NL

NightLitch

#5
Reopened...


In the new hubsoft I get a problem when restarting the script...

The Log-File is getting erased when restarting script... not good.... why???

//NL

plop

#6
remove(filename)
thats all you need 2 delete a file.

for closing you don't need 2 say wich file.
closefile()    is enough.

plop

* edit: not 2 sure but the way you try 2 close the file could cause it not 2 be closed an then you get an error on restart of the script because the file is in use.
not 2 sure do.
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NightLitch

#7
Think you missed my problem, When I restart The scripts
the OnExit () trigger as well, shouldn't it only trigger when hubsoft
getting closed or turned off...

My Online User Table(file) is being erased when restarting script....

And That is not the way I want it...

I use last script above...

/NightLitch
//NL

pHaTTy

Hmmm, maybe because OnExit has not been perfected, needs to be only on hubclose, but it seems to be on restart as well :/
Resistance is futile!

plop

what i remember is that it was the idea 2 trigger it on a restart of the scripts and on a full hub restart.
that way you can save any temp files you want.
only making it trigger on a hub restart makes it in my eyes only work half.
what you can do in your case is save the online table 2 a 2de file, and on function main() check for the amount of users.
on a script restart that will be ~= 0 so you load the temp file.
if there are no users you build a new empty table.
i hope you get my idea and that i did get your idea, really sleepy @ the moment.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk