hey all, this is my first post on the board and i'm not a completely newbie to lua scripting, so it aint too bad :)
right, what i want to beable to do is have a script which sends out a PM to all users, read from a text file, in passive mode. this text file should be sent out every 5 minutes, or whatever period of time is appropriate. i would also be greatful if you could get it into a command is well for OPs which will send the PM outside of the timed PMed....ie. +active and then it sends out a PM to all users in passive.
To help you lot, i found this part of a script and thought it should help, although this only sends the PM on enter and and it doesnt read the writing from a text file or send it periodically;
Bot = ".:: Infiniti? ::."
function DataArrival(user,data)
if not user.bOperator then
if strfind(data,"$MyINFO",1,1) then
if strfind(data, "M:P", 1, 1) then
user:SendPM(Bot, "Please Check this link to get into active mode. thank you ---- ")
Thanks for helping in advanced :)
Hi there, welcome to this board and prepare to waste your life scripting ... up to now it has taken a graduation degree in Architecture and the half of my summer ...
--- PasssivePMs ? requested by DiLLio
--- by Herodes ? 6:26 pm (GMT+2:00) 8-7-2004
botsName = "HeyPassive" --- Change this to whatever u want
TxtPassive = "getactive.txt" --- be sure to have a file corresponding to this one in the 'scripts'
passivecmd = "!goactive" --- change this to whatever u want ...
countOPs = 0 --- if u want your Operators to receive such pm then put this equal to 1
secs = 1000
mins = 60*secs
timerinterval = 15*mins --- I hope this is clear enough ...
function Main()
tPassiveUsers = {n=0}; --- don't touch this one ...
frmHub:UnregBot(botsName) --- Unreg the Bot from the NickList, ( using the string defined by the ' botsName ' value )
frmHub:RegBot(botsName) --- and Register it again ... ( using the string defined by the ' botsName ' value, again )
SetTimer(timerinterval)
StartTimer()
end
function OnTimer()
for index, nick in tPassiveUsers do
SendPmToNick(nick, botsName, ReadTextFile(TxtPassive))
end
end
function OpConnected(user)
if ( countOPs == 1 ) then
NewUserConnected(user)
end
end
function NewUserConnected(user)
if ( strfind(user.sMyInfoString, ",M:P,") ) then
tinsert(tPassiveUsers, (getn(tPassiveUsers)+1), user.sName)
end
end
function UserDiconnected(user)
if user.sName == tPassiveUsers then
tremove(tPassiveUsers, user.sName)
end
end
function OpDisconnected(user)
if ( countOPs == 1 ) then
UserDiconnected(user)
end
end
function DataArrival(user, data)
if ( ( strsub(data, 1, 1) == "<" ) and user.bOperator )then
data = strsub(data,1,strlen(data)-1)
local s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
if ( cmd == passivecmd ) then
if getn(tPassiveUsers) >= 25 then
user:SendPM(botsName, getn(tPassiveUsers).." users have been notified on their passive connection mode.")
else user:SendPM(botsName, "The following users have been notified on their passive connection mode : ")
for i = 1, getn(tPassiveUsers) do
user:SendPM(botsName, "\t"..tPassiveUsers[i])
end
end
for index, nick in tPassiveUsers do
if nick == user.sName then
else SendPmToNick(nick, botsName, ReadTextFile(TxtPassive))
end
end
end
end
end
function ReadTextFile(file)
local message = "\r\n"
readfrom(file, "r")
while 1 do
local line = read()
if ( line == nil ) then break
else message = message.."\t"..line.."\r\n"
end
end
readfrom()
return message
end
Wow, just want to say, what a fast response.
I really wasn't expecting anything for the next 36 hours.
And the script, does what i wanted streamlessly plus the notification PM to the user. This script is great :D .
Not too sure about all this wasted life :P
Just wanted to ask, how long did it take you to write that script? I spent about 4 hours just trying to find that extract i did.
Cheers, Mate!
QuoteOriginally posted by DiLLio This script is great :D .
Thank you m8!
DiLLio : Not too sure about all this wasted life :P
Think again .. :D
QuoteOriginally posted by DiLLio
Just wanted to ask, how long did it take you to write that script?
I spent about 30' - 45' to put it together and test it ... :)
Nice script, exactly wat i'm after aswell. Does any1 av a copy of the txt file 2 accompany it?
Thanx in advance,
Quik.
You lot are really good at this...
Right, the text i put together is below. I didn't want to put too much text in so as not to flood the users with too much text... ;)
This is an automated pop-up that you will recieve periodically for as long as you are in passive mode.
To stop this, please follow the intructions below:
Solution #1 -
You maybe just need to do into go into settings (File/Settings...) and change the circle dot from passive to active.
IF Solution #1 did not work then proceed...
Solution #2 -
Go to [URL]http://www.dslreports.com/faq/dc[/URL] for an EXTENSIVE list of all routers and how to open a port with them and to sort out any other problems you maybe be having with your DC++ client
Thanks for your help and we hope to see you all reaping the benifits of active mode across our network.
Regards.
I'm not too sure whether i can continue in this thread about another script im looking for or not, so im just gona describe it and if its meant to be in a new thread ill say it again in another one...or one of your super people can move it :)
In our hub we have OPs, Admins, Owners, VIPs and so on. What i want to beable to do is set up another profile (Servers) which have the OP Status (the golden key) however have the same commands and user rights as a standard reg/vip. i.e. no kick/ban/gag/warn etc commands. Thanks. :))