PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: TofuDrifter on 18 May, 2005, 20:57:37

Title: PM to Passive users
Post by: TofuDrifter on 18 May, 2005, 20:57:37
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.
Title:
Post by: Dessamator on 18 May, 2005, 21:36:20
--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 !
Title:
Post by: [UK]Madman on 18 May, 2005, 21:44:50
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
Title:
Post by: TofuDrifter on 18 May, 2005, 22:18:25
wow that was very fast , thanks alot guys :)
Title:
Post by: TofuDrifter on 18 May, 2005, 22:23:20
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 ?
Title:
Post by: jiten on 18 May, 2005, 22:47:21
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
Title:
Post by: [UK]Madman on 18 May, 2005, 23:22:52
Thank you jiten  :]

How can I forget soooo many brackets in 1 tiny script  ?   ?(

Ammended my above post too.
Title:
Post by: TofuDrifter on 19 May, 2005, 01:56:51
ok its working great now guys thanks again , this is one of the best fourms on the planet
Title:
Post by: jiten on 19 May, 2005, 09:58:16
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
Title: Re: PM to Passive users
Post by: 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
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   
Title: Re: PM to Passive users
Post by: Markitos on 07 March, 2006, 08:48:52
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

Title: Re: PM to Passive users
Post by: Jacko on 08 March, 2006, 20:40:40
Thanks Markitos will give this a try

sorry about delay in my reply have been afk for a few days    ;)
Title: Re: PM to Passive users
Post by: Jacko on 08 March, 2006, 21:44:28
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
Title: Re: PM to Passive users
Post by: 6Marilyn6Manson6 on 08 March, 2006, 22:03:09
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
Title: Re: PM to Passive users
Post by: bastya_elvtars on 08 March, 2006, 22:29:36
user:SendPM is faster.
Title: Re: PM to Passive users
Post by: 6Marilyn6Manson6 on 09 March, 2006, 00:54:36
Done :D
Title: Re: PM to Passive users
Post by: Jacko on 09 March, 2006, 21:32:32
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
Title: Re: PM to Passive users
Post by: Jacko on 10 March, 2006, 19:11:24
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