PM to Passive users
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

PM to Passive users

Started by TofuDrifter, 18 May, 2005, 20:57:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TofuDrifter

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.

Dessamator

#1
--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 !
Ignorance is Bliss.

[UK]Madman

#2
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

TofuDrifter

wow that was very fast , thanks alot guys :)

TofuDrifter

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 ?

jiten

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

[UK]Madman

Thank you jiten  :]

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

Ammended my above post too.

TofuDrifter

ok its working great now guys thanks again , this is one of the best fourms on the planet

jiten

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

Jacko

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   
if I read this for long enough maybe one day i will understand

Markitos

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

Jacko

Thanks Markitos will give this a try

sorry about delay in my reply have been afk for a few days    ;)
if I read this for long enough maybe one day i will understand

Jacko

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
if I read this for long enough maybe one day i will understand

6Marilyn6Manson6

#13
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

bastya_elvtars

Everything could have been anything else and it would have just as much meaning.

6Marilyn6Manson6


Jacko

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
if I read this for long enough maybe one day i will understand

Jacko

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
if I read this for long enough maybe one day i will understand

SMF spam blocked by CleanTalk