Hi there.
this is the first time i write to this forum,so let's make it a good one.
what i want to do is:
count total users in the hub,count the passive users in the hub,and count the not-registered users in the hub.
why?
i want to let the script sen a pm to all the passive users and tell them that they can't download from the other passive users.in the pm should be te ammount of passive users that are in the hub,and the active
the same i want with te not registered users.
and can this be done with a timer?so they will get a message everey 6 hour or so?
don't know what happens when a user is a non registered passive user ?( :O
is ther also a way to limit the ammount of passive users in the hub?
so if i set the max to 150 passive users,all the other passive users will be rederected to the network?
ok,this is it for now
thanks for the time it took reading this message,
seeya,
greetings dreveltje.
the Idea is not bad at all, only thing there (AFAIK) isint such a function that counts active or passive users (If there is, then post it here)
okey i am trying to get this script working,somehow it doesn't send a pm.i have made a textfile in my scriptsmap so that isn't the problem.
i know this script works,because i've used it before.
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 = 59*secs --- 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)
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
i also use this script,it sends a pm to the not-regged user,and displays a message in main.
this one works just fine.
maybe there is something in it you like :P
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 = 59*secs --- 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)
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
aggain thanks for your time.
greetings dreveltje.
guestion .... i started the script .. and i am wondering way not all profiles get the pop up! Wat can i do ?