hi
just a quick question to anyone that might know!
when you click [stop server] all the users in the hub just disconnect and server stops but i want the hub to save the nicks of all the users who are in the hub to a text file when the hub stops. does anyone know how or if this can be done?
thanks
oooh, i see u want to learn how to do so, ok here are some hints:
1. When then hub is closed or script restarted the OnExit function automatically kicks in !
2. You have to use a loop to pass through the users in the user list or online users and then add each username(nick) to a variable.
3. Write the variable to a file .
and voila,
ok i understand how to do no.1 and no.3 but im not too sure how to do no.2? any tips?
--No 3. is simple look in the api aka Scripting-Interface.txt for clues , basically u need to find the table of logged users, collect each userName and store it in a variable !
P.S variable is something like temp="dd"
the variable is "temp"
lol, mutor he was trying to do on his own, ur
spoon-feeding him !
oooh, ok hehe, seems im wrong again, its just that spoon feeding newbies, just makes them lazy, and ask simple question, while they could learn easily !
possum hehe, ive not heard that one for some time :D
anyway thanks for the help, btw Mutor that bit of code does look familar. i remember doing something like that in the old ' Inspector ' script.
Dessamator its not spoon-feeding at all, i DID post in the ' Request for scripts ' section ;)
i am basically just trying to design a last seen script and with a built in auto dereg user if they havent logged in for a long period of a given time.
once i get it working properly i will recode it again and again until the code is smaller and better. aint LUA fun :D
yep i forgot what section of the forum we were in, either way since this is the case
for the number 2 hint i meant something like this :
function OnExit()
local temp ="logged users\r\n"
for _,nick in frmHub:GetOnlineUsers() do
temp=temp..nick.."\r\n"
end
-- write temp to a file
end
nice bit of code and so to obmit the unreg users from that i could use...
code:--------------------------------------------------------------------------------
function OnExit()
local temp ="logged users\r\n"
for _,nick in frmHub:GetOnlineUsers() do
if nick.iProfile ~= -1 then
temp=temp..nick.."\r\n"
end
end
-- write temp to a file
end
--------------------------------------------------------------------------------
Hmm i might just give that a go :) thanks
ur welcome
just tested your version of that script you posted and i get errors...
local ' nick ' a table value
cant see the error msg cos it flashes quick and disapears but its there
indeed, there should b an error, forgot something :
function OnExit()
local temp ="logged users\r\n"
for _,nick in frmHub:GetOnlineUsers() do
temp=temp..nick[COLOR=blue].sName[/COLOR] .."\r\n"
end
-- write temp to a file
end
add the part in blue, and it should work, that happens because the table has objects and not "normal" items.