PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: JaPaja on 27 November, 2006, 15:18:49

Title: Bot sending PM on log into Hub?
Post by: JaPaja on 27 November, 2006, 15:18:49
Hi,

does exist Bot, that send to user in PM message which is more longer than 20 lines? I have text also in txt file. PtokaX/scripts/txt/rules.txt.

Can anyone help me?
Title: Re: Bot sending PM on log into Hub?
Post by: bastya_elvtars on 27 November, 2006, 16:26:13
Sending MOTD in PM? :-)
Title: Re: Bot sending PM on log into Hub?
Post by: JaPaja on 27 November, 2006, 16:29:49
No, I mean, I hve some actuality and I want send it in PM. I send MOTD in main chat but simetimes i will need send some notice to every connected user.
Title: Re: Bot sending PM on log into Hub?
Post by: bastya_elvtars on 27 November, 2006, 17:34:09
I'll hack one together for you later, if noone else does.
Title: Re: Bot sending PM on log into Hub?
Post by: st0ne-db on 27 November, 2006, 20:07:17
Hi JaPaja,
have you checked out cron?

http://forum.ptokax.org/index.php?topic=6441#msg63238 (http://forum.ptokax.org/index.php?topic=6441#msg63238)
Title: Re: Bot sending PM on log into Hub?
Post by: JaPaja on 27 November, 2006, 20:56:05
I mean something like this:


Bot = "[BOT]Keli?ov?"

function NewUserConnected(user)
SendPM(???????????????????)
end



But i dont know how should i write that i want send textfile "pravidla.txt" that are stored in PtokaX/scripts/txt/pravidla.txt  . Bot is storet in PtokaX/scripts/

D U understand me?
Title: Re: Bot sending PM on log into Hub?
Post by: st0ne-db on 27 November, 2006, 21:39:27
Quote from: JaPaja on 27 November, 2006, 20:56:05
I mean something like this:


Bot = "[BOT]Keli?ov?"

function NewUserConnected(user)
SendPM(???????????????????)
end



But i dont know how should i write that i want send textfile "pravidla.txt" that are stored in PtokaX/scripts/txt/pravidla.txt  . Bot is storet in PtokaX/scripts/

D U understand me?

I think I understand...  is this what you are asking for?


Bot = "[BOT]Keli?ov?"

function NewUserConnected(user)
local xStr = ""
local hxFile,sErr = io.open("txt/pravidla.txt","r")
if hxFile then
xStr = hxFile:read("*a")
hxFile:close(xFile)
io.flush()
else
xStr = sErr
end
SendPM(Bot,xStr)
end
Title: Re: Bot sending PM on log into Hub?
Post by: Thor on 27 November, 2006, 22:35:10
Maybe check this (http://forum.ptokax.org/index.php?topic=6313.0) too.
stone-db, why not:
Bot = "[BOT]Kelišov?"

function NewUserConnected(user)
local xStr = ""
local hxFile,sErr = io.open("txt/pravidla.txt","r")
if hxFile then
xStr = string.gsub(hxFile:read("*a"),string.char(10), "\r\n")
hxFile:close(xFile)
io.flush()
else
SendToOpChat("Error in onjoin-file-show script: "..sErr)
end
user:SendPM(Bot,xStr)
end
Title: Re: Bot sending PM on log into Hub?
Post by: st0ne-db on 27 November, 2006, 22:53:39
Quote from: Hungarista on 27 November, 2006, 22:35:10
Maybe check this (http://forum.ptokax.org/index.php?topic=6313.0) too.
stone-db, why not:
[ snip ]

Even better   ;D