PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: Bumbi on 05 April, 2007, 13:07:41

Title: need a simple PM2OP script
Post by: Bumbi on 05 April, 2007, 13:07:41
Hi
I need a simple Pm2op script so my users can send a message to opchat when they need to reg som friends into my hub. Did have that when I was running Robocop. Can someone help me?

Regards Bumbi  ::)
Title: Re: need a simple PM2OP script
Post by: Leun on 05 April, 2007, 15:43:26
Use the search button!!!
There are already such kind of scripts, only not all of them are called pm2ops.

But, I?ve made a very small script for you, for little help ( during my training periode, so I didn?t test it).

Greetz,




--very simple account request bot
-- made in 10  min :-)
-- Didn't test it !!!!

-- The profiles can PM the Bot
sProfiles = {
[-1] = 1,  -- Users
[0] = 0,   -- Masters
[1] = 0,   -- OPs
[2] = 0,   -- VIPs
[3] = 0,   -- REGs
[4] = 0,   -- MODs
[5] = 0,   -- Founders
}

-- Profiles who receive feed
gProfiles = {
[-1] = 0,  -- Users
[0] = 1,   -- Masters
[1] = 1,   -- OPs
[2] = 0,   -- VIPs
[3] = 0,   -- REGs
[4] = 1,   -- MODs
[5] = 1,   -- Founders
}

tSettings = {
sBot = "Pm2ops",
sPrefix = "#",
sCmd = "regme"
}
function Main()
frmHub:RegBot(tSettings.sBot)
end

function ChatArrival(curUser,data)
local data = string.sub(data,1,-2)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if sProfiles[curUser.iProfile] == 1 then
if cmd and (cmd== tSettings.sPrefix..tSettings.sCmd) then
local _,_,sPass = string.find(data,"%b<>%s+%S+%s+(%S+)")
if sPass then
SendToPMtoOps("Dear Operators user "..curUser.sName.." wants to be registered can some one help! Password: "..sPass)
curUser:SendData(tSettings.sBot, "Your request is send to all Operators, they will register you as soon as possible, if you agree with the rules!!")
else
curUser:SendData(tSettings.sBot, " *** You have to provide a password!")
end
end

end
end

function ToArrival(curUser,data)
data = string.sub(data,1,-2)
local _,_,whoto,data = string.find(data,"$To:%s+(%S+)%s+From:%s+%S+%s+$%b<>%s+(.*)")
if (whoto == tSettings.sBot) then
if sProfiles[curUser.iProfile] == 1 then
SendToPMtoOps("User: <"..curUser.sName.."> needs help: "..data)
end
end
end

function SendToPMtoOps(msg)
for i,v in frmHub:GetOnlineUsers() do
if gProfiles[v.iProfile] == 1 then
v:SendPM(tSettings.sBot,msg)
end
end
end
Title: Re: need a simple PM2OP script
Post by: Cêñoßy†ê on 05 April, 2007, 19:06:01
Or  try this ..
Not tested either ;)
Code (lua) Select

--[[
Pm to bot sends message to opchat
]]--

Bot = "PM_to_OPs"

Main = function()
frmHub:RegBot(Bot,1,"PM me to give message to all operators","")
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
SendToOpChat("Message from: <"..user.sName.."> -> "..msg)
user:SendPM(Bot,"Your message is send to all Operators, they will get back to you when they have readed the message.")
end
end
Title: Re: need a simple PM2OP script
Post by: Bumbi on 06 April, 2007, 13:35:28
Thanks C??o?y??
Working great

Bumbi