hello i am looking for a lua5 script that will send a private message to only passive users with a time that i can set either like a specific time of day or every so many hours. any help would be greatly appreciated.
--By Dessamator
--Pm to Passive User v1
min=30 -- time to wait b4 sending msg
-- config
bot=frmHub:GetHubBotName() -- bots name
msg="blah" -- msg to send to passive users
-- config
function Main()
SetTimer(60*1000*min)
StartTimer()
end
function OnTimer()
for pos,user in frmHub:GetOnlineUsers() do
if not(user.bActive) then
user:SendPM(bot,msg)
end
end
end
Done !
My attempt, can send a manual PM as well as an automatic one.
-- Simple message to passive users
-- By [UK]Madman
-- Can change the interval at which the PM are sent automatically
-- Can use the command to send manually
tSet = {}
tSet.sBot = frmHub:GetHubBotName()
tSet.iTime = 1*hour -- set the interval here eg 1*day
tSet.sComm = "!pmpassive" -- command to send manual message
tSet.sMsg = "TYPE THE MESSAGE TO BE SENT HERE!"
sec = 1000
min = 60*sec
hour = 60*min
day = 24*hour
function Main()
SetTimer(tSet.iTime)
StartTimer()
end
function OnTimer()
sendpm()
end
function sendpm()
for key,value in frmHub:GetOnlineUsers() do
if value.bPassive and not value.bOperator then
SendPmToNick(value.sName, tSet.sBot, tSet.sMsg)
end
end
end
function ChatArrival(tCuruser,sData)
sData = string.sub(sData,1,string.len(sData)-1)
s,e,sCom = string.find(sData,"%b<>%s(%S+)")
if sCom == tSet.sComm then
sendpm()
return 1
end
end
wow that was very fast , thanks alot guys :)
one problem with the second one ...
i get a error that says lus:16:function arguments expected near 'tSet'
any idea how to correct this ?
Maybe this:
-- Simple message to passive users
-- By [UK]Madman
-- Can change the interval at which the PM are sent automatically
-- Can use the command to send manually
tSet = {}
tSet.sBot = frmHub:GetHubBotName()
tSet.iTime = 1*hour -- set the interval here eg 1*day
tSet.sComm = "!pmpassive" -- command to send manual message
tSet.sMsg = "TYPE THE MESSAGE TO BE SENT HERE!"
sec = 1000
min = 60*sec
hour = 60*min
day = 24*hour
function Main()
SetTimer(tSet.iTime)
StartTimer()
end
function OnTimer()
sendpm()
end
function sendpm()
for key,value in frmHub:GetOnlineUsers() do
if not value.bActive and not value.bOperator then
SendPmToNick(value.sName, tSet.sBot, tSet.sMsg)
end
end
end
function ChatArrival(tCuruser,sData)
local sData = string.sub(sData,1,string.len(sData)-1)
local s,e,sCom = string.find(sData,"%b<>%s(%S+)")
if sCom == tSet.sComm then
sendpm()
end
end
Thank you jiten :]
How can I forget soooo many brackets in 1 tiny script ? ?(
Ammended my above post too.
ok its working great now guys thanks again , this is one of the best fourms on the planet
QuoteOriginally posted by [UK]Madman
Thank you jiten :]
How can I forget soooo many brackets in 1 tiny script ? ?(
Ammended my above post too.
You're welcome m8.
Btw, it (forgetting) happens to all of us (specially at night with me) :D
Cheers
Would it be possible to make this script only pm by profile so as not to pm ops and vips
And if i set timer to 0 would it ignore the timer as i would like to just send manualy
At the moment i have a help txt file which is on a !active command would it be possible for script
to send that txt file as a pm so as to try and get more users to put a bit of effort to become active
thanks
Quote from: Jacko on 05 March, 2006, 21:05:46
Would it be possible to make this script only pm by profile so as not to pm ops and vips
And if i set timer to 0 would it ignore the timer as i would like to just send manualy
thanks
-- Simple message to passive users
-- By [UK]Madman
-- Can change the interval at which the PM are sent automatically
-- Can use the command to send manually
-- Send To = 1, Dont Send To = 0
tSet = {}
tSet.sBot = frmHub:GetHubBotName()
tSet.iTime = 1*hour -- set the interval here eg 1*day
tSet.sComm = "!pmpassive" -- command to send manual message
tSet.sMsg = "TYPE THE MESSAGE TO BE SENT HERE!"
SendTo = {
[-1] = 1, -- Unreg
[0] = 0, -- Master
[1] = 0, -- OPS
[2] = 0, -- Vips
[3] = 1, -- Regs
[4] = 0, -- Mods
[5] = 0, -- Founder
}
sec = 1000
min = 60*sec
hour = 60*min
day = 24*hour
function Main()
SetTimer(tSet.iTime)
StartTimer()
end
function OnTimer()
sendpm()
end
function sendpm(user)
for key,value in frmHub:GetOnlineUsers() do
if not value.bActive and not value.bOperator and SendTo[user.sName] == 1 then
SendPmToNick(value.sName, tSet.sBot, tSet.sMsg)
end
end
end
function ChatArrival(tCuruser,sData)
local sData = string.sub(sData,1,string.len(sData)-1)
local s,e,sCom = string.find(sData,"%b<>%s(%S+)")
if sCom == tSet.sComm then
sendpm()
end
end
This is my try and i you want just to send the warn manually just remove
tSet.iTime = 1*hour -- set the interval here eg 1*day
and
sec = 1000
min = 60*sec
hour = 60*min
day = 24*hour
function Main()
SetTimer(tSet.iTime)
StartTimer()
end
Thanks Markitos will give this a try
sorry about delay in my reply have been afk for a few days ;)
I have butchered Madmans good working script down so as to just send as pm but i now get this
hub-17.08..RCv10.01\scripts\pmpassive.lua:29: attempt to index local `user' (a nil value)
Could anyone help a daft bloke please? ????
-- Simple message to passive users
-- By [UK]Madman
-- Can change the interval at which the PM are sent automatically
-- Can use the command to send manually
--? Send To = 1, Dont Send To = 0
tSet = {}
tSet.sBot = frmHub:GetHubBotName()
tSet.sComm = "!pmpassive" -- command to send manual message
tSet.sMsg = "FOR PASSIVE USERS/r/nPlease type? !active? in main for help to set up active mode/r/nActive mode is hugely better for you and for hubs"
SendTo = {
[-1] = 0, -- Unreg
[0] = 0, -- Master
[1] = 0, -- OPS
[2] = 0, -- Vips
[3] = 0, -- Regs
[4] = 0, -- Mods
[5] = 1, -- Founder
}
function OnTimer()
sendpm()
end
function sendpm(user)
for key,value in frmHub:GetOnlineUsers() do
if not value.bActive and not value.bOperator and SendTo[user.sName] == 1 then
SendPmToNick(value.sName, tSet.sBot, tSet.sMsg)
end
end
end
function ChatArrival(tCuruser,sData)
local sData = string.sub(sData,1,string.len(sData)-1)
local s,e,sCom = string.find(sData,"%b<>%s(%S+)")
if sCom == tSet.sComm then
sendpm()
end
end
Change:
function sendpm(user)
for key,value in frmHub:GetOnlineUsers() do
if not value.bActive and not value.bOperator and SendTo[user.sName] == 1 then
SendPmToNick(value.sName, tSet.sBot, tSet.sMsg)
end
end
end
To:
function sendpm(user)
for key,user in frmHub:GetOnlineUsers() do
if not user.bActive and not user.bOperator and SendTo[user.sName] == 1 then
user:SendPM(user.sName, tSet.sBot, tSet.sMsg)
end
end
end
C ya
user:SendPM is faster.
Done :D
Sorry to pester
I think i have followed all,? i now get no errors but message never gets sent and also command shows in main
can anyone help please....This is what i now have
? ? ? ? ? ? ? ? ? thanks for replies bastya & 6Marilyn6
-- Simple message to passive users
-- By [UK]Madman
-- Can change the interval at which the PM are sent automatically
-- Can use the command to send manually
--? Send To = 1, Dont Send To = 0
tSet = {}
tSet.sBot = frmHub:GetHubBotName()
tSet.sComm = "!pmpassive" -- command to send manual message
tSet.sMsg = "TYPE THE MESSAGE TO BE SENT HERE!"
SendTo = {
[-1] = 1, -- Unreg
[0] = 0, -- Master
[1] = 0, -- OPS
[2] = 0, -- Vips
[3] = 0, -- Regs
[4] = 0, -- Mods
[5] = 1, -- Founder
}
function OnTimer()
sendpm()
end
function sendpm(user)
for key,user in frmHub:GetOnlineUsers() do
if not user.bActive and not user.bOperator and SendTo[user.sName] == 1 then
user:SendPM(user.sName, tSet.sBot, tSet.sMsg)
end
end
end
function ChatArrival(tCuruser,sData)
local sData = string.sub(sData,1,string.len(sData)-1)
local s,e,sCom = string.find(sData,"%b<>%s(%S+)")
if sCom == tSet.sComm then
sendpm()
end
end
Thanks very much Mutor
I am starting to think that there may be a small bug in my version of PtokaX (0.3.3.0 build 17.08 [debug]
now when i send !pmpsv i dont see comand in main but also dont get the msg sent,
Maybe time to upgrade PtokaX but this has worked fine untill now