PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: Mozzilla? on 02 December, 2006, 21:46:26

Title: Personal Log for HubOwners
Post by: Mozzilla? on 02 December, 2006, 21:46:26
Just a little script for all you HubOwners who want a personal log of all your hubs login's

------------------------------------------------------------------------------------------
-- Connection Log for HubOwners
-- Written by Mozzilla?
------------------------------------------------------------------------------------------
-- Each time anybody enters the hub a PM will be sent to the HubOwner(s)
--
-- Quite a lot of assistance provided by Mutor
-- Thanks for all your help Mutor with this script
------------------------------------------------------------------------------------------
 
Bot = "??CONN?CT?ON?LOG??" 
 
SendTo = { -- Who gets the PM 
[6] = 1, -- Owners 
}

cProfile = { -- The profiles that will be shown in the PM each time they connect to the hub 
[-1] = 1, 
[0] = 1, 
[1] = 1, 
[2] = 1, 
[3] = 1, 
[4] = 1, 
[5] = 1, 
}

Main = function()
if Bot == frmHub:GetHubBotName() and frmHub:GetHubBot()== 0 or Bot ~= frmHub:GetHubBotName() then
frmHub:RegBot(Bot, 1,"Connection log for PtokaX ".._VERSION, "user@domain.com")
end
end

function NewUserConnected(user) 
if cProfile[user.iProfile] and cProfile[user.iProfile] == 1 then
local Profile  = GetProfileName(user.iProfile) or "Unregistered User"
local msg = os.date("\r\n\tJust a little message to let the HubOwners "..
"know that\r\n\t"..Profile.." "..user.sName.." with IP "..user.sIP..
" \r\n\tentered "..frmHub:GetHubName()..
" on %a %d/%m/%Y at %H:%M:%S")
for i,v in ipairs(frmHub:GetOnlineRegUsers()) do
if SendTo[v.iProfile]and SendTo[v.iProfile] ==1 then
SendPmToNick(v.sName,Bot,msg)
end
end
if SendTo[user.iProfile]and SendTo[user.iProfile] ==1 then
user:SendPM(Bot,msg)
end
end
end
OpConnected = NewUserConnected


Posted on: November 27, 2006, 03:49:10 am
Changed the script slightly for those who don't use Profile [6]

------------------------------------------------------------------------------------------
-- Connection Log for HubOwners
-- Written by Mozzilla?
------------------------------------------------------------------------------------------
-- Each time anybody enters the hub a PM will be sent to the HubOwner(s)  
-- 
-- Quite a lot of assistance provided by Mutor
-- Thanks for all your help Mutor with this script
--
-- Removed Profile [6]
-- Altered script slightly to allow for HubOwners name to be entered
------------------------------------------------------------------------------------------
 
Bot = "Your-Choice-Of-BotName-Here" or frmHub:GetBotName()
 
HubOwner = "HubOwners-Nick-Here"    -- If more than one owner seperate with a comma and a space - "Owner1, Owner2"

cProfile = { -- The profiles that will be shown in the PM each time they connect to the hub - 1 = show, 0 = don't show
[-1] = 1, 
[0] = 1, 
[1] = 1, 
[2] = 1, 
[3] = 1, 
[4] = 1, 
[5] = 1, 
}


function NewUserConnected(user) 
if cProfile[user.iProfile] and cProfile[user.iProfile] == 1 then
local Profile  = GetProfileName(user.iProfile) or "Unregistered User"
local msg = os.date("\r\n\tJust a little message to let the HubOwners "..
"know that\r\n\t"..Profile.." "..user.sName.." with IP "..user.sIP..
" \r\n\tentered "..frmHub:GetHubName()..
" on %a %d/%m/%Y at %H:%M:%S")
for i,v in ipairs(frmHub:GetOnlineRegUsers()) do
if user.sName ~= HubOwner then
SendPmToNick(v.sName,Bot,msg)
end
end
if user.sName ~= HubOwner then
user:SendPM(Bot,msg)
end
end
end
OpConnected = NewUserConnected


Posted on: November 28, 2006, 01:41:45 pm
>:( grrrr!!!

I knew i should have tested that second script!!!

Can anybody assist me to get it working properly?

It appears that each time somebody enters the hub the person entering gets the PM and not the hub owner.

DOH@me

lol
Title: Re: Personal Log for HubOwners
Post by: Herodes on 02 December, 2006, 22:01:17
Maybe you want this ...
function NewUserConnected(user) 
if cProfile[user.iProfile] and cProfile[user.iProfile] == 1 then
local Profile  = GetProfileName(user.iProfile) or "Unregistered User"
local msg = "\r\n\tJust a little message to let the HubOwners know that\r\n\t"..Profile.." "..user.sName.." with IP "..user.sIP.."\r\n\t entered "..frmHub:GetHubName().." on "..os.date(%a %d/%m/%Y at %H:%M:%S")
for hubown in string.gmatch( HubOwner, "%,?%s*(%S+)%s*%,?") do
SendPmToNick( hubown, Bot, msg )
end
end
end


Ooh.. by the way I am moving this to [Lua 5.1 / Help with scripts]
Title: Re: Personal Log for HubOwners
Post by: Mozzilla? on 03 December, 2006, 18:28:39
Thanks once again for your assistance Mutor.

And thankyou also to Herodes.