Hola guys,
lookin 4 script that sends text file to PMs only to unregs every 10 min.
thx in advince :))
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 :)
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 :))
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
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)
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 :)
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.
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 ?(
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.
QuoteOriginally posted by bastya_elvtars
Edited again, sorry, but I was in a hurry.
@last work fine, thx man :P
Yes now work :P