PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Loading on 06 July, 2005, 00:19:46

Title: Timed mass message
Post by: Loading on 06 July, 2005, 00:19:46
hello ppl

i have a timed mass message
but it only sends a message to unreg users

and i want to chose to profile i want the message goes to

like :

netfounder = 1
master = 0
moderator = 0
op = 1
vip = 1
reg = 1
user = 0

the script i have is thiss :
--Lua 5 By Dessamator(added message To Profile)

-- timed mass message from text by ?˜”??•Hawk•??”˜?

-- create a massmessage.txt file in the scripts directory

-- containing your message





SendEvery = 1   ----  time in hrs

textfile = "massmessage.txt"

bot = frmHub:GetHubBotName()

hrs = 1000 * 60 * 60 * SendEvery

ProfileNumber= -1 -- type here the profile u wish to send to




function Main()

SetTimer(hrs)

StartTimer()

end





function OnTimer()

local handle = io.open(textfile, "r")

if (handle ~= nil) then

                  Temptimerfile = "\r\n"

for line in io.lines(textfile) do

Temptimerfile = Temptimerfile.."\r\n"..line

io.read()

end

for pos,user in frmHub:GetOnlineUsers(ProfileNumber) do

user:SendPM(bot, Temptimerfile)

end

io.close()

end

end



and to tranform  this :

SendEvery = 1   ----  time in hrs

i want te timer im minutes if possible

Best regards

Loading
Title:
Post by: ??????Hawk?????? on 06 July, 2005, 00:33:02
Not tested  let me know if  alls well  



--Lua 5 By Dessamator(added message To Profile)
-- timed mass message from text by ??????Hawk??????
-- create a massmessage.txt file in the scripts directory
-- containing your message


CanDo = {
[0] = 1, -- Master
[1] = 1, -- Operator
[2] = 1, -- VIP
[3] = 0, -- Reg
[4] = 0, -- Moderator
[5] = 1, -- Netfounder
[-1] =0, -- User
}

SendEvery = 1   ----  time in Mins
textfile = "massmessage.txt"
bot = frmHub:GetHubBotName()
hrs = 1000 * 60 * SendEvery


function Main()
SetTimer(hrs)
StartTimer()
end





function OnTimer()
local handle = io.open(textfile, "r")
if (handle ~= nil) then
                 Temptimerfile = "\r\n"
for line in io.lines(textfile) do
Temptimerfile = Temptimerfile.."\r\n"..line
io.read()
end
for prf,sw in CanDo do
if sw == 1 then
for pos,user in frmHub:GetOnlineUsers(prf) do
user:SendPM(bot, Temptimerfile)
end
end
end
end
io.close()
end
Title:
Post by: Loading on 06 July, 2005, 00:42:05
i get this error :

[23:40] Syntax E:\Programas\Ptokax 0.3.3.0.b17.04.nt.dbg\scripts\Timed Mass message.lua:96: `end' expected (to close `function' at line 63) near `'

Loading
Title:
Post by: ??????Hawk?????? on 06 July, 2005, 00:46:24
heheh you must have been  quick  i spotted the mistake as soon as i posted it  ..  

i edited the code..  

try again   :P  :P  :P  :P
Title:
Post by: Loading on 06 July, 2005, 01:09:46
hi

tanks hawk for the modifications

it works in the all profiles

tanks man

Best regards

Loading
Title:
Post by: ??????Hawk?????? on 06 July, 2005, 01:24:27
:))  :))  :))  :))
Title:
Post by: chettedeboeuf on 16 July, 2005, 22:35:32
Hi Hawks,
Is it possible to have the same script with more messages ??
And with command for add messages as '!addmess' ??

Thank you very much
Title: Timed message
Post by: TopCat on 04 August, 2005, 23:33:29
Hai everybody ,

I was looking for a script like this :)

Can someone change this script so it works for in main and not in pm please  :D

--Lua 5 By Dessamator(added message To Profile)
-- timed mass message from text by ??????Hawk??????
-- create a massmessage.txt file in the scripts directory
-- containing your message


CanDo = {
Title:
Post by: Dessamator on 04 August, 2005, 23:48:34
change this
user:SendPM(bot, Temptimerfile)

to this
SendToAll((bot, Temptimerfile)
Title:
Post by: TopCat on 06 August, 2005, 00:08:15
Thx for your reaction Dessamator :)

Ive changed it but getting this error in de ptokax

[00:03] Syntax ...ings\Default\Mijn documenten\Forbiddenpalace\robo10\scripts\advertiser.lua:43: `)' expected near `,'
[00:03] Syntax advertiser.lua:43: `)' expected near `,'

I dont know what is wrong ,Ihope you can tell me ?  :D