Pm text 2 unregs
 

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 text 2 unregs

Started by witch, 06 October, 2005, 00:26:19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

witch

Hola guys,
lookin 4 script that sends text file to PMs only to unregs every 10 min.

thx in advince  :))



6Marilyn6Manson6

#1
Try this:


-- Optimized Lua 5 version by jiten
-- RegHound 1.0 by Mutor The Ugly 7/10/14
-- Fixed small bug by 6Marilyn6Manson6
--
-- Prompts unregistered users to register on repaeating interval; Hounds in Main Chat, as well as PM
-- User Settings -------------------------------------------------------------------------------------
sBot = frmHub:GetHubBotName()	-- Name for bot[You can use your main bot, if so no need to register this bot
Mins =  "10"					-- Interval [in minutes] to PM unregistered Users
UnRegMsg = "message goes here"	-- Message to send to unregistered Users
-- End User Settings ---------------------------------------------------------------------------------

Main = function() 
	SetTimer(Mins*60000) StartTimer()
end

OnTimer = function()
	local i,v
	for i,v in frmHub:GetOnlineNonOperators() do
		if v.iProfile == -1 then
			v:SendPM(sBot, UnRegMsg)
		end
	end
end


c ya :)

witch

yeah that's exactly what i need. thx a lot 6Marilyn6Manson6  :D

script works fine, but i got little reqest if u don't mind...is it posseble to make that script PM them msg not from here
UnRegMsg = "message goes here"-- Message to send to unregistered Users
but from folder, for example "pm2unregs", cose msg that i want to send to them is really big and got ascii inside, so i can't feet it on the script.

thx in advince  :))



bastya_elvtars

#3
Will this do?

-- Optimized Lua 5 version by jiten
-- RegHound 1.0 by Mutor The Ugly 7/10/14
-- Fixed small bug by 6Marilyn6Manson6
-- Added file loading instead of setting the message
-- It reads from a folder called pm2unregs
-- which must be created in the scripts folder.
-- // bastya_elvtars

-- Prompts unregistered users to register on repaeating interval; Hounds in Main Chat, as well as PM
-- User Settings -------------------------------------------------------------------------------------

sBot = frmHub:GetHubBotName()	-- Name for bot[You can use your main bot, if so no need to register this bot

Mins =  "10"					-- Interval [in minutes] to PM unregistered Users

FileName = "unregmessage.txt"	-- Text file containing stuff to send to unregistered Users

-- End User Settings ---------------------------------------------------------------------------------



Main = function() 
  SetTimer(Mins*60000) StartTimer()
  local f=io.open("pm2unregs/"..FileName,"r")
  if f then
    contents = string.gsub(f:read("*a"),string.char(10), "\r\n")
    f:close()
  end
end

OnTimer = function()
  for _,obj in ipairs(frmHub:GetOnlineNonOperators()) do
    if obj.iProfile == -1 then
      obj:SendPM(sBot, contents)
    end
  end
end
Everything could have been anything else and it would have just as much meaning.

witch

got this error

[04:48] Syntax ...1.10.05\![pz]0.3.3.21.nt.dbg\scripts\Text2unregs.lua:67: attempt to index global `v' (a nil value)



6Marilyn6Manson6

#5
Try this:

--- Periodical PMs to unregs ? by Herodes 4-4-2005
--- fixed small bug by 6Marilyn6Manson6

botsName = "...::TripBot::..."--- Change this to whatever u want 
TxtFile = "unRegFile.txt" --- be sure to have a file corresponding to this one in the 'scripts' 
thecmd = "!pmunregs "--- change this to whatever u want ... 

secs = 1000 
mins = 60*secs 
timerinterval = 10*mins--- I hope this is clear enough ... 

function Main() 
	frmHub:RegBot(botsName)--- and Register it again ... ( using the string defined by the ' botsName ' value, again ) 
	SetTimer(timerinterval) 
	StartTimer() 
end 

function OnTimer() 
	SendEm()
end 

function ChatArrival( user, data) 
	if user.bOperator then
		data = string.sub(data,1,-2) 
		local s,e,cmd = string.find( data, "%b<>%s+(%S+)" ) 
		if ( cmd == thecmd ) then 
			SendEm()
		end
	end
end 
function SendEm()
	local sText = ReadTextFile(TxtFile) 
	for i, user in frmHub:GetOnlineUsers() do 
		if user.iProfile == -1 then
			user:SendPM(botsName, sText)
		end
	end
end

function ReadTextFile(file) 
	local f=io.open(file, "r");
	if f then local m=f:read("*all");f:close;return m;end;
	return "file isn't there";
end

c ya :)

bastya_elvtars

QuoteOriginally posted by witch
got this error

[04:48] Syntax ...1.10.05\![pz]0.3.3.21.nt.dbg\scripts\Text2unregs.lua:67: attempt to index global `v' (a nil value)

Edited the above, sorry.
Everything could have been anything else and it would have just as much meaning.

witch

thx 6Marilyn6Manson6 for another 1, but got this error:
[07:22] Syntax ...[pz]0.3.3.21.nt.dbg01.10.05\![pz]0.3.3.21.nt.dbg\scripts\Text2unregs.lua:83: function arguments expected near `;'

QuoteOriginally posted by bastya_elvtars

Edited the above, sorry.
thx for corections, no syntax errors anymore, but script dosn't work, no PMs to unregs sended  ?(



bastya_elvtars

QuoteOriginally posted by witch

thx for corections, no syntax errors anymore, but script dosn't work, no PMs to unregs sended  ?(

Edited again, sorry, but I was in a hurry.
Everything could have been anything else and it would have just as much meaning.

witch

QuoteOriginally posted by bastya_elvtars

Edited again, sorry, but I was in a hurry.
@last work fine, thx man  :P



6Marilyn6Manson6


SMF spam blocked by CleanTalk