PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Request for scripts => Topic started by: uffetjur on 17 March, 2008, 03:25:35

Title: PM to Ops
Post by: uffetjur on 17 March, 2008, 03:25:35
I search the forum but couldnt find script for sending Pm to Ops
So hopegully someone could ill my request or point to a thread a missed
Thanks in advance!
Title: Re: PM to Ops
Post by: Madman on 17 March, 2008, 08:16:15

--[[
Pm to bot sends message to opchat
Made by C??o?y†?
Converted to API2 by Madman
]]--

Bot = "PM_to_OPs"

OnStartup = function()
Core.RegBot(Bot,"PM me to give message to all operators","",true)
end

ToArrival = function(user,data)
data = string.sub(data,1,-2)
local _,_,to,msg = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$%b<>%s+(.*)")
if to == Bot then
Core.SendToOpChat("Message from: <"..user.sNick.."> -> "..msg)
Core.SendPmToUser(user,Bot,"Your message is sent to all Operators, they will get back to you when they have readed the message.")
end
end
Title: Re: PM to Ops
Post by: uffetjur on 17 March, 2008, 19:52:52
Thanks alot again for fast respons!

Thank god for our friendly scripters who keeps us ptokax lovers satisfied!
Title: Re: PM to Ops
Post by: badboyyyyyy on 09 November, 2008, 22:30:24
Quote from: Madman on 17 March, 2008, 08:16:15

--[[
Pm to bot sends message to opchat
Made by C??o?y??
Converted to API2 by Madman
]]--

Bot = "PM_to_OPs"

OnStartup = function()
Core.RegBot(Bot,"PM me to give message to all operators","",true)
end

ToArrival = function(user,data)
data = string.sub(data,1,-2)
local _,_,to,msg = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$%b<>%s+(.*)")
if to == Bot then
Core.SendToOpChat("Message from: <"..user.sNick.."> -> "..msg)
Core.SendPmToUser(user,Bot,"Your message is sent to all Operators, they will get back to you when they have readed the message.")
end
end



how to reorganize so that only namen sends messages to me and not OPchat :) sorry for my english
Title: Re: PM to Ops
Post by: badboyyyyyy on 09 November, 2008, 23:48:27
Quoteremoved, please do not quote code blocks... -- b_e


thank you Mutor :)
Title: Re: PM to Ops
Post by: badboyyyyyy on 10 November, 2008, 23:24:48
Can you add Pm to Pm sends message to opchat and to me (mainchat/pm)

user  < - >  user                      Message To <"user.sNick"> from: <"..user.sNick..">"..msg)
user < - > OP                           Message To <"user.sNick"> from: <"..op.sNick..">"..msg)   
Op < - > user                            Message To <"..op.sNick"> from: <"..user.sNick..">"..msg)

[0=no 1=yes],

Profiles = {
    
Title: Re: PM to Ops
Post by: LeBleu on 21 November, 2008, 21:54:34
ok, how about answering maschine bot that keeps messages for me i'm not at hub?
bot named like me that when PMed tells anybody "I'm currently offline, I'll answer as soon as I connect"
and forwards all messages with sender when i connect to hub.
Title: Re: PM to Ops
Post by: ATAG on 21 November, 2008, 22:30:54
Search for PostMan (http://forum.ptokax.org/index.php?topic=7889.0)
Title: Re: PM to Ops
Post by: LeBleu on 21 November, 2008, 23:26:50
i saw it, but 1. it's beta, and 2. i'd like to keep it as simple as it can be, i run lan hub on old, very low-end pc.
and, as this topic is very close to what i'd like to recive, therefore i hoped someone could enhance that just a little bit..

Anyway, is its ok that doesn't do what it's supposed to, but tells user he sent the message?
when there is no OPs, user reads the message that's sent anyway- 'Your message was sent..',
so why he should care if there is any OP online? So, the best solution should be to just deliver the message
as soon as any OP logs in, correct?
Title: Re: PM to Ops
Post by: LeBleu on 22 November, 2008, 03:12:05
simply, because I work on my latop and I take it with me often out. And hub is old desktop with no keyboard or monitor connected, usualy  working 24/7 under my bed in dorm. I connect to it and manage by telenet and uploading files to shared drive, so no way i could read messages from client i could possibly run on it.

please, can you add there a routine that if no OPs are online writes message to file and when OP connects it would just take all messages from that file and PM them to operator? Or reading/writing files by lua is so much harder than it sounds?
Title: Re: PM to Ops
Post by: LeBleu on 22 November, 2008, 03:34:31
It runs microXP, telenet serviced by netcat, but has 96Mb ram so it's kinda short of system resources to run additional apps..
It's only hub and nothing else so i don't need virtual desktop or anything.
Is it that much a trouble to simply write msg at the end of file and to read whole file and clean it?
Title: Re: PM to Ops
Post by: LeBleu on 22 November, 2008, 10:07:00
Quote from: LeBleu on 21 November, 2008, 23:26:50
Anyway, is its ok that doesn't do what it's supposed to, but tells user he sent the message?
when there is no OPs, user reads the message that's sent anyway- 'Your message was sent..',
so why he should care if there is any OP online? So, the best solution should be to just deliver the message
as soon as any OP logs in, correct?
Quote from: LeBleu on 22 November, 2008, 03:12:05
please, can you add there a routine that if no OPs are online writes message to file and when OP connects it would just take all messages from that file and PM them to operator? Or reading/writing files by lua is so much harder than it sounds?
I'm pretty sure that's on topic, right?
If not, then I give up.